subplot

OpenCV (Python) video subplots

∥☆過路亽.° 提交于 2019-12-22 10:28:10
问题 I am trying to show two OpenCV video feeds in the same figure as subplots, but couldn't find how to do it. When I try using plt.imshow(...), plt.show() , the window won't even appear. When I try using cv2.imshow(...) , it shows two independent figures. What I actually want are subplots :(. Any help? Here is the code that I have so far: import numpy as np import cv2 import matplotlib.pyplot as plt cap = cv2.VideoCapture(0) ret, frame = cap.read() while(True): ret, frame = cap.read() channels =

setting the axis min and max values to stick

淺唱寂寞╮ 提交于 2019-12-22 09:58:00
问题 I have a (3,4) subplot each showing scatterplots. The ranges of the scatterplots vary so some of my plots have axes x(0-30) and y(0-8), but some have x(18-22) and y(4-7). I have set my xlim to [0 30], and ylim to [0 8] but that sets my axes to never go lower than 0, higher than 30 etc. How do I set my axis to "stick" at (0,0) for the origin of each plot, and "stick" at 8 for Y and 30 for X. TIA for any help update per comment on answer: Still having the same issue with below code %% plot for

Automate the Populating of Subplots

假如想象 提交于 2019-12-22 08:07:11
问题 I am in the process of writing a python script that will (1) obtain a list of y-values for each subplot to plot against a common set of x-values, (2) make each of these subplots a scatter-plot and put it in the appropriate location in the subplot grid, and (3) complete these tasks for different sizes of subplot grids. What I mean by the third statement is this: the test case I'm using results in an array of 64 plots, 8 rows and 8 columns. I would like for the code to be able to handle any

loop over 2d subplot as if it's a 1-D

不打扰是莪最后的温柔 提交于 2019-12-22 04:43:20
问题 I'm trying to plot many data using subplots and I'm NOT in trouble but I'm wondering if there is a convenience method to do this. below is the sample code. import numpy as np import math import matplotlib.pyplot as plt quantities=["sam_mvir","mvir","rvir","rs","vrms","vmax" ,"jx","jy","jz","spin","m200b","m200c","m500c","m2500c" ,"xoff","voff","btoc","ctoa","ax","ay","az"] # len(quantities) = 21, just to make the second loop expression # shorter in this post. ncol = 5 nrow = math.ceil(21 /

loop over 2d subplot as if it's a 1-D

流过昼夜 提交于 2019-12-22 04:43:08
问题 I'm trying to plot many data using subplots and I'm NOT in trouble but I'm wondering if there is a convenience method to do this. below is the sample code. import numpy as np import math import matplotlib.pyplot as plt quantities=["sam_mvir","mvir","rvir","rs","vrms","vmax" ,"jx","jy","jz","spin","m200b","m200c","m500c","m2500c" ,"xoff","voff","btoc","ctoa","ax","ay","az"] # len(quantities) = 21, just to make the second loop expression # shorter in this post. ncol = 5 nrow = math.ceil(21 /

Expand (maximise) subplot figure temporarily — then collapse it back

筅森魡賤 提交于 2019-12-21 19:40:23
问题 Often in Matlab we would plot a figure with many subplot axes, but they are all tiny. In the prevalent UX paradigm, you would expect to be able to double-click such a small plot to have a closer look using the entire screen space. Typically this is the reason I avoid using subplot , but plot many individual figures instead — so I can move them around on the screen and double-click on their titlebars which (on Windows) maximises the figure to full screen. (Double-click again, and it returns to

Matplotlib: Repositioning a subplot in a grid of subplots

僤鯓⒐⒋嵵緔 提交于 2019-12-20 20:43:08
问题 I am trying to make a plot with 7 subplots. At the moment I am plotting two columns, one with four plots and the other with three, i.e. like this: I am constructing this plot in the folowing way: #! /usr/bin/env python import numpy as plotting import matplotlib from pylab import * x = np.random.rand(20) y = np.random.rand(20) fig = figure(figsize=(6.5,12)) subplots_adjust(wspace=0.2,hspace=0.2) iplot = 420 for i in range(7): iplot += 1 ax = fig.add_subplot(iplot) ax.plot(x,y,'ko') ax.set

Change spacing of dashes in dashed line in matplotlib [duplicate]

…衆ロ難τιáo~ 提交于 2019-12-20 16:46:28
问题 This question already has an answer here : Are there really only 4 Matplotlib Line Styles? (1 answer) Closed 3 years ago . In Python, using matplotlib, is there a way to change the distance of the dashes for different linestyles, for example, using the following command: plt.plot(x,y,linestyle='--') 回答1: You can directly specify the dashes length/space using the dashes=(length, interval space) argument inside the plot command. import matplotlib.pyplot as plt fig,ax = plt.subplots() ax.plot([0

Python - Organisation of 3 subplots with matplotlib

蓝咒 提交于 2019-12-20 10:46:19
问题 I try to generate 3 subplots for my figure. It seems work but it is not perfectly aligned. How to have the same width between the figure at the bottom et the figures at below? plt.close() fig = plt.figure() ax1 = plt.subplot(211) ax1.plot(cycles,np.asarray(df_int),'wo',label='') ax1.plot(cycles,np.asarray(df_proj),'k+',label='') ax1.legend(loc=2) #ax1.subplots_adjust(left=0.15) ax1.set_ylim(0.001,0.004) ax2 = plt.subplot(223) i2=ax2.imshow(c,cmap=plt.cm.hot, vmin=-5, vmax=5);#plt.colorbar()

Inconsistent tick labels font with matplotlib subplots

我的梦境 提交于 2019-12-20 04:09:45
问题 I'm making a grid of plots using matplotlib.pyplot.subplots , and I want the tick labels to be in LaTeX's sans-serif font, but when I do use subplots I always get at least one tick label rendered in matplotlib's default font. Here's a MWE: import matplotlib.pyplot as plt fig, axes = plt.subplots(nrows=1, ncols=1) x = [1,2,3,4,5] plt.plot(x) plt.rc('text', usetex=True) plt.rc('font', family='sans-serif') plt.show() If you comment out the fig, axes = plt.subplots line, the tick labels display