Open jfear opened 6 years ago
Hi @jfear glad it helps. I think there might be a solution using the figure templating function. @florisvb what do you think?
Yea that could work I think.
@jfear - could you put together a short example that you wish would work? That would be a good starting point I think.
On Tue, Oct 2, 2018 at 11:16 AM Theodore Lindsay notifications@github.com wrote:
Hi @jfear https://github.com/jfear glad it helps. I think there might be a solution using the figure templating function. @florisvb https://github.com/florisvb what do you think?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/FlyRanch/figurefirst/issues/41#issuecomment-426377624, or mute the thread https://github.com/notifications/unsubscribe-auth/AAPCPPqkqsXmXIOapLc5FvFs4fkhP1CBks5ug62DgaJpZM4XEebR .
-- Floris van Breugel Currently: Moore-Sloan / Sackler Fellow at UW, Seattle, WA Soon: Assistant Professor of Mechanical Engineering at UNR, Reno, NV Science: http://www.florisvanbreugel.com
Wildlife and Landscape Photography Galleries: http://www.ArtInNaturePhotography.com/ Blog: http://www.ArtInNaturePhotography.com/wordpress/
Thank you for the quick response.
Environment
# python 3.6
numpy==1.13.1
seaborn==0.9.0
matplotlib==2.2.3
I would like generate something like this:
import numpy as np
import seaborn as sns
dat = np.random.rand(100).reshape(10, 10)
g = sns.clustermap(dat)
g.fig.savefig('clustermap.svg')
I would then want to clustermap.svg
and add it to a FigureFirst template. Something like:
import numpy as np
import matplotlib.pyplot as plt
from figurefirst import FigureLayout
layout = FigureLayout('hello_world_layout.svg')
# some sort of magic like this
layout.add_svg_to_axis('clustermap.svg', 'axis')
layout.insert_figures('target_layer_name')
layout.write_svg('hello_world_output.svg')
Other use cases:
Thanks again for taking a look at this, it sounds like a complicated problem to me.
FigureFirst looks like a very exciting project, your have identified a major pain point for many people.
I was looking through the documentation, and I was wondering if you had any suggestions for placing a separate mpl.Figure() onto a FigureFirst axis. For example, some of seaborn's more complicated plots (e.g., clustermap, FacetGrid) use gridspec under the hood to build an entire figure. There is no way to pass a mpl.Axes() to the plotting function.
The only possible solution I could think of is: create the seaborn figure, save it as SVG, and then import and add that to the FigureFirst template. Is it possible to import an separate SVG image and add that to a FigureFirst axis? If not it would be a nice feature.
Thanks again for the neat tool, I am going to start playing with it.