subplot

How can I plot subplots with nested plot arrowed at a specific point?

只谈情不闲聊 提交于 2021-02-20 04:05:40
问题 I saw this chart in a paper and need to reproduce it. How can I plot a figure like this in Python? Note that: I suspect bigger subplots are perhaps drawn using seaborn or using matplotlib's subplot The smaller plots are POINTING at a specific part of the curve in the bigger plots. 回答1: One strategy can be using mpl_toolkits.axes_grid1.inset_locator , as suggested in the answer to this question: How to overlay one pyplot figure on another I have made a quick example: import matplotlib.pyplot

One slider controlling multiple subplots in R

若如初见. 提交于 2021-02-20 02:46:49
问题 I want to use one slider to control multiple subplots created with plotly. I found answers in Python like these two: Plot.ly. Using slider control with multiple plots https://community.plot.ly/t/using-one-slider-to-control-multiple-subplots-not-multiple-traces/13955/4 Example (second link): import plotly.graph_objs as go from plotly.tools import make_subplots fig = make_subplots(1, 2) fig.add_scatter(y=[1, 3, 2], row=1, col=1, visible=True) fig.add_scatter(y=[3, 1, 1.5], row=1, col=1, visible

One slider controlling multiple subplots in R

大兔子大兔子 提交于 2021-02-20 02:45:50
问题 I want to use one slider to control multiple subplots created with plotly. I found answers in Python like these two: Plot.ly. Using slider control with multiple plots https://community.plot.ly/t/using-one-slider-to-control-multiple-subplots-not-multiple-traces/13955/4 Example (second link): import plotly.graph_objs as go from plotly.tools import make_subplots fig = make_subplots(1, 2) fig.add_scatter(y=[1, 3, 2], row=1, col=1, visible=True) fig.add_scatter(y=[3, 1, 1.5], row=1, col=1, visible

How to add legends (labels) and fix tight layout in a subplot with multiple plots

▼魔方 西西 提交于 2021-02-11 14:54:24
问题 I have the following code to generate a (2,2) gridspec subplots. gs=GridSpec(2,2) fig=plt.figure(figsize= (12,6)) ax1=fig.add_subplot(gs[0,0]) ax2=fig.add_subplot(gs[0,1]) ax3=fig.add_subplot(gs[1,:]) ax1.plot(df_wip[['CADUSD=X', 'INRUSD=X', 'PLNUSD=X']], label= ['CAD', 'INR', 'PLN']) ax1.legend() ax2.plot(df_wip[['BRLUSD=X', 'ZARUSD=X']]) ax2.set_xticks([]) ax3.plot(df_wip[['CL=F', 'GC=F', '^TNX']]) gs.tight_layout(fig) See that the legends are not appropriate, and xticks are tight. How to

how to loop to create subplots in Plotly, where each subplot has a few curves on it?

筅森魡賤 提交于 2021-02-11 13:46:34
问题 I already wrote below nested loops to generate 21 charts with success (one chart for each country, for example german gas austrian gas) dfs is a dict with 21 countries names as keys and their respective gas storage dfs as values for country in list(dfs_storage.keys()): df_country=dfs_storage[country] month = list(set(df_country['month'])) fig = go.Figure() for year in set(df_country['year']): workingGasVolume_peryear=df_country.loc[df_country['year']==year,'workingGasVolume'] gasInStorage

how to loop to create subplots in Plotly, where each subplot has a few curves on it?

旧时模样 提交于 2021-02-11 13:45:16
问题 I already wrote below nested loops to generate 21 charts with success (one chart for each country, for example german gas austrian gas) dfs is a dict with 21 countries names as keys and their respective gas storage dfs as values for country in list(dfs_storage.keys()): df_country=dfs_storage[country] month = list(set(df_country['month'])) fig = go.Figure() for year in set(df_country['year']): workingGasVolume_peryear=df_country.loc[df_country['year']==year,'workingGasVolume'] gasInStorage

How to make an axes occupy multiple subplots when using pandas datetime plot?

感情迁移 提交于 2021-02-10 16:01:19
问题 I would like to create a (sub)plot with two rows and two columns where the plot in the lower row occupies both axes. Since I use the plot from within pandas datetime (I think) I was not able to use this solution. fig, axes = plt.subplots(nrows=2, ncols=2) df1.set_index('Date').plot(ax=axes[0,0]) df2.set_index('Date').plot(ax=axes[0,1]) df3.set_index('Date').plot(ax=axes ??? ) How do I need to assign the axes (if at all possible) in order to get something like this: 回答1: You can do in this way

How to make an axes occupy multiple subplots when using pandas datetime plot?

北慕城南 提交于 2021-02-10 16:00:22
问题 I would like to create a (sub)plot with two rows and two columns where the plot in the lower row occupies both axes. Since I use the plot from within pandas datetime (I think) I was not able to use this solution. fig, axes = plt.subplots(nrows=2, ncols=2) df1.set_index('Date').plot(ax=axes[0,0]) df2.set_index('Date').plot(ax=axes[0,1]) df3.set_index('Date').plot(ax=axes ??? ) How do I need to assign the axes (if at all possible) in order to get something like this: 回答1: You can do in this way

Subplots: tight_layout changes figure size

ぐ巨炮叔叔 提交于 2021-02-08 07:29:33
问题 Changing the vertical distance between two subplot using tight_layout(h_pad=-1) changes the total figuresize. How can I define the figuresize using tight_layout? Here is the code: #define figure pl.figure(figsize=(10, 6.25)) ax1=subplot(211) img=pl.imshow(np.random.random((10,50)), interpolation='none') ax1.set_xticklabels(()) #hides the tickslabels of the first plot subplot(212) x=linspace(0,50) pl.plot(x,x,'k-') xlim( ax1.get_xlim() ) #same x-axis for both plots And here is the results: If

Subplots: tight_layout changes figure size

廉价感情. 提交于 2021-02-08 07:28:35
问题 Changing the vertical distance between two subplot using tight_layout(h_pad=-1) changes the total figuresize. How can I define the figuresize using tight_layout? Here is the code: #define figure pl.figure(figsize=(10, 6.25)) ax1=subplot(211) img=pl.imshow(np.random.random((10,50)), interpolation='none') ax1.set_xticklabels(()) #hides the tickslabels of the first plot subplot(212) x=linspace(0,50) pl.plot(x,x,'k-') xlim( ax1.get_xlim() ) #same x-axis for both plots And here is the results: If