subplot

Plotting a horizontal line on multiple subplots in python using pyplot

白昼怎懂夜的黑 提交于 2019-11-27 12:56:57
问题 I am plotting three subplots on the same page. I want to draw a horiZontal line through all the subplots. Following is my code and the resultant graph: (You can notice I can get the horizontal line on one of the plots, but not all) gs1 = gridspec.GridSpec(8, 2) gs1.update(left=0.12, right=.94, wspace=0.12) ax1 = plt.subplot(gs1[0:2, :]) ax2 = plt.subplot(gs1[3:5, :], sharey=ax1) ax3 = plt.subplot(gs1[6:8, :], sharey=ax1) ax1.scatter(theta_cord, density, c = 'r', marker= '1') ax2.scatter(phi

Matplotlib - global legend and title aside subplots

只愿长相守 提交于 2019-11-27 11:16:11
I've started with matplot and managed some basic plots, but now I find it hard to discover how to do some stuff I need now :( My actual question is how to place a global title and global legend on a figure with subplots. I'm doing 2x3 subplots where I have a lot of different graphs in various colors (about 200). To distinguish (most) of them I wrote something like def style(i, total): return dict(color=jet(i/total), linestyle=["-", "--", "-.", ":"][i%4], marker=["+", "*", "1", "2", "3", "4", "s"][i%7]) fig=plt.figure() p0=fig.add_subplot(321) for i, y in enumerate(data): p0.plot(x, trans0(y),

How to reduce the borders around subplots in matlab? [duplicate]

爱⌒轻易说出口 提交于 2019-11-27 09:40:29
问题 This question already has answers here : Closed 8 years ago . Possible Duplicate: MATLAB subplot margin In matlab, an inordinate amount of space is wasted around subplots. For example, in this example: t = 0:0.001:2*pi+0.001; figure(2); for i = 1 : 25; subplot(5,5,i); plot(t, sin(i*t)); axis off end over 50% of the space on the figure is wasted as "blank" I'd like to shrink that blank space down, but have been unsuccessful to identify a mechanism to do so. Thoughts? Thanks John 回答1: The

Row and column headers in matplotlib's subplots

匆匆过客 提交于 2019-11-27 09:13:50
问题 What's the best practise to add a row and a column header to a grid of subplots generated in a loop in matplotlib ? I can think of a couple, but not particularly neat: For columns, with a counter to your loop you can use set_title() for the first row only. For rows this doesn't work. You would have to draw text outside of the plots. You add an extra row of subplots on top and an extra column of subplots on the left, and draw text in the middle of that subplot. Can you suggest a better

Figure GUI freezing

雨燕双飞 提交于 2019-11-27 08:36:50
问题 I am fairly new in python, and I am trying to have a plot, based on data stored in a file. This file may be updated at any time, so I am trying to make the drawing updated every 3 seconds (so I don't use all the CPU). My problem is that the GUI freezes after the lunch. #!/usr/bin/python # _*_ coding: utf8 _*_ import matplotlib.pyplot as plt import numpy as np import time plt.ion() plt.figure() i=0 while 1: taille=0 fichier=np.loadtxt('data/US.SAVE') fichier1=np.loadtxt('data/cond.SAVE')

How to give subtitles for subplot in plot_ly using R

99封情书 提交于 2019-11-27 05:45:36
问题 I am wondering how to give difference subtitles for the subplots using plot_ly. Any hint please. I got one title BB in this case. Thanks. p <- subplot( plot_ly(economics, x = date, y = uempmed)%>%layout(showlegend = FALSE, title="AA"), plot_ly(economics, x = date, y = unemploy)%>%layout(showlegend = FALSE, title="BB"), margin = 0.05 ) 回答1: The title attribute in layout refers to the title for the entire plotting surface, so there can only be one. However, we can use text annotations to create

How to use matplotlib to create a large graph of subplots?

情到浓时终转凉″ 提交于 2019-11-26 21:43:56
问题 I am having trouble looping through each subplot. I reach the coordinates for the subplot, and then want different models to appear on each subplot. However, my current solution loops through all of the subplots, but at each one loops through all of the models, leaving the last model to be graphed at each subplot, meaning they all look the same. My goal is to place one model on every subplot. Please help! modelInfo = csv_info(filename) # obtains information from csv file f, axarr = plt

pyplot axes labels for subplots

不想你离开。 提交于 2019-11-26 19:15:37
I have the following plot: import matplotlib.pyplot as plt fig2 = plt.figure() ax3 = fig2.add_subplot(2,1,1) ax4 = fig2.add_subplot(2,1,2) ax4.loglog(x1, y1) ax3.loglog(x2, y2) ax3.set_ylabel('hello') I want to be able to create axes labels and titles not just for each of the two subplots, but also common labels that span both subplots. For example, since both plots have identical axes, I only need one set of x and y- axes labels. I do want different titles for each subplot though. I tried a few things but none of them worked right You can create a big subplot that covers the two subplots and

Matplotlib - adding subplots to a subplot?

拜拜、爱过 提交于 2019-11-26 18:18:58
问题 I'm trying to create a figure that consists of a 2x2 grid, where in each quadrant there are 2 vertically stacked subplots (i.e. a 2x1 grid). I can't seem to figure out how to achieve this, though. The closest I've gotten is using gridspec and some ugly code (see below), but because gridspec.update(hspace=X) changes the spacing for all of the subplots I'm still not where I'd like to be. Ideally what I want is to, using the picture below as an example, decrease the spacing between the subplots

Matplotlib - global legend and title aside subplots

这一生的挚爱 提交于 2019-11-26 15:24:52
问题 I've started with matplot and managed some basic plots, but now I find it hard to discover how to do some stuff I need now :( My actual question is how to place a global title and global legend on a figure with subplots. I'm doing 2x3 subplots where I have a lot of different graphs in various colors (about 200). To distinguish (most) of them I wrote something like def style(i, total): return dict(color=jet(i/total), linestyle=["-", "--", "-.", ":"][i%4], marker=["+", "*", "1", "2", "3", "4",