subplot

Updating bar and plot subplots over loop iterations

久未见 提交于 2020-01-11 07:09:25
问题 I wrote the following snippet and I am trying to make it update the plots. What I get instead is an overlapping of new plots on the old ones. I researched a bit and found I needed relim() and autoscale_view(True,True,True) on the current axis. I still cannot get the desired behaviour. Is there a way to force pyplot to delete/remove the old drawing before calling plt.draw()? import numpy as np import matplotlib.pyplot as plt import time plt.ion() a = np.arange(10) fig,ax = plt.subplots(2,1)

is it possible to change the height of a subplot?

心不动则不痛 提交于 2020-01-07 09:03:08
问题 I have a total of 4 subplots. 1st and 3rd are the actual Signals and 2nd and 4th are their respective clock signals i.e. they are either 0 or 1. The Problem with subplots is that all the plots are of same height. But i want the height of the clock signals to be small compared to the actual signals. and the respective clock signals should be just below their actual signals. I would summarise my requirements: Reducing the height of the clock signals subplot(i.e the 2nd and the 4th subplot).

aligning matplotlib subplots legends

家住魔仙堡 提交于 2020-01-07 08:34:06
问题 I have a few subplots for which one has less curves (see figure). I want the legend of the second plot to be at the same height as the others. Switching the order of the two handles is not a valid option. Thanks guys! 回答1: After a lot of trials, I added a dummy curve: axarr[1].plot([], [], label=" ", c="w") 来源: https://stackoverflow.com/questions/43833721/aligning-matplotlib-subplots-legends

How to subplot pie chart in plotly?

倾然丶 夕夏残阳落幕 提交于 2020-01-06 07:02:30
问题 How can I subplot 'pie1' in 'fig', so it be located at 'the first' position. this is how I am doing it but it doesn't work out import pandas as pd import numpy as np import seaborn as sns import plotly.offline as pyp import plotly.graph_objs as go from plotly import tools import plotly.plotly as py from plotly.offline import iplot,init_notebook_mode from IPython.core.display import HTML import plotly.io df1=pd.read_excel('file.xlsx',sheet_name='sheet1',index=False) con_pivot=pd.pivot_table

How to subplot pie chart in plotly?

北战南征 提交于 2020-01-06 07:01:12
问题 How can I subplot 'pie1' in 'fig', so it be located at 'the first' position. this is how I am doing it but it doesn't work out import pandas as pd import numpy as np import seaborn as sns import plotly.offline as pyp import plotly.graph_objs as go from plotly import tools import plotly.plotly as py from plotly.offline import iplot,init_notebook_mode from IPython.core.display import HTML import plotly.io df1=pd.read_excel('file.xlsx',sheet_name='sheet1',index=False) con_pivot=pd.pivot_table

Combining 2 joyplots with same x-axis

前提是你 提交于 2020-01-06 05:24:26
问题 I have a code for plotting ridgeplot ( joyplot ). import joypy fig, axes = joypy.joyplot([RZS_P['RZ'][(RZS_P['P_2001'] > range_P[i]) & (RZS_P['P_2001'] <= range_P[i]+500)] for i in range(8)], ylim='own', overlap = 1, bins = 20, figsize=(6,8), alpha = 1, labels = labels,grid=True, color ='black', fill = False, lw = 2) for i in range(len(sample)): plt.xlim(0,800) ######### The code below is for different data with same x-axis fig, axes = joypy.joyplot([RZS_P['Rootzone'][(RZS_P['P_2012'] > range

Superimposing two plots with different axes

余生颓废 提交于 2020-01-05 08:58:25
问题 I am working on a some sort of System test wherein i have a set of readings in the form of a .mat file. It has a structure in the .mat file with one field as Measurement. It has several Arrays(e.g air mass flow, velocity,acceleration, carbon content) which further have fields like time and value. I Need to plot different field valus against the respective times. I have two fields as velocity and acceleration. I Need to plot it on the same curve with grids on for the comparison. But the y axis

How to create one common legend for 4 subplots in MATLAB?

╄→гoц情女王★ 提交于 2020-01-04 02:48:29
问题 How can I create one common legend for 4 subplots in MATLAB, like this: 回答1: Quick and dirty: hSub = subplot(3,1,1); plot(1,1,1,1,1,1,1,1); hLegend = legend('hello','i','am','legend'); subplot(3,2,3), plot(10:-1:1); subplot(3,2,4), plot(1:100); subplot(3,2,5), stem(1:10); subplot(3,2,6), plot(randn(1,100)) set(hLegend, 'position', get(hSub, 'position')); 来源: https://stackoverflow.com/questions/26704815/how-to-create-one-common-legend-for-4-subplots-in-matlab

global legend for all subplots

馋奶兔 提交于 2020-01-03 03:45:06
问题 I create an n x n matrix of matplot subplots which contain the same type of curve (lets name them signal1 and signal2): n=5 f, axarr = plt.subplots(n,n) for i,signal_generator in enumerate(signal_generators): y=i%n x=(i-y)/n axarr[x, y].plot(signal_generator.signal1) axarr[x, y].plot(signal_generator.signal2) Since the 2 signals in each subplot each represent the same types, I want to use a figure global legend with the two entries 'signal1' 'signal2', rather then attaching the same legend to

How do I change matplotlib's subplot projection of an existing axis?

六眼飞鱼酱① 提交于 2020-01-01 01:09:39
问题 I'm trying to construct a simple function that takes a subplot instance ( matplotlib.axes._subplots.AxesSubplot ) and transforms its projection to another projection, for example, to one of the cartopy.crs.CRS projections. The idea looks something like this import cartopy.crs as ccrs import matplotlib.pyplot as plt def make_ax_map(ax, projection=ccrs.PlateCarree()): # set ax projection to the specified projection ... # other fancy formatting ax2.coastlines() ... # Create a grid of plots fig,