subplot

Create Table in subplot

帅比萌擦擦* 提交于 2019-12-18 07:24:10
问题 I have a python plot and then would like to have a set of statistics in a table in a subplot adjacent to it. I have used kind of an adhoc approach in which I create a subplot with white axis colors and then make a table in the subplot. You can see that the table has white lines running through it if you look closely. My code is below. import pandas as pd import numpy as np import datetime as dt import matplotlib.pyplot from patsy import dmatrices import statsmodels.api as sm import matplotlib

How to unset `sharex` or `sharey` from two axes in Matplotlib

拥有回忆 提交于 2019-12-18 04:57:06
问题 I have a series of subplots, and I want them to share x and y axis in all but 2 subplots (on a per-row basis). I know that it is possible to create all subplots separately and then add the sharex/sharey functionality afterward. However, this is a lot of code, given that I have to do this for most subplots. A more efficient way would be to create all subplots with the desired sharex / sharey properties, e.g.: import matplotlib.pyplot as plt fix, axs = plt.subplots(2, 10, sharex='row', sharey=

How to create Pandas groupby plot with subplots?

巧了我就是萌 提交于 2019-12-18 03:39:35
问题 I have a data frame like this: value identifier 2007-01-01 0.781611 55 2007-01-01 0.766152 56 2007-01-01 0.766152 57 2007-02-01 0.705615 55 2007-02-01 0.032134 56 2007-02-01 0.032134 57 2008-01-01 0.026512 55 2008-01-01 0.993124 56 2008-01-01 0.993124 57 2008-02-01 0.226420 55 2008-02-01 0.033860 56 2008-02-01 0.033860 57 So I do a groupby per identifier: df.groupby('identifier') And now I want to generate subplots in a grid, one plot per group. I tried both df.groupby('identifier').plot

Row titles for matplotlib subplot

偶尔善良 提交于 2019-12-17 16:45:33
问题 In matplotlib, Is it possible to set a a separate title for each row of subplots in addition to the title set for the entire figure and the title set for each individual plot? This would correspond to the orange text in the figure below. If not, how would you get around this problem? Create a separate column of empty subplots to the left and fill them with the orange text? I am aware that it is possible to manually position each single title using text() or annotate() , but that usually

Multiple figures in a single window

夙愿已清 提交于 2019-12-17 16:35:42
问题 I want to create a function which plot on screen a set of figures in a single window. By now I write this code: import pylab as pl def plot_figures(figures): """Plot a dictionary of figures. Parameters ---------- figures : <title, figure> dictionary """ for title in figures: pl.figure() pl.imshow(figures[title]) pl.gray() pl.title(title) pl.axis('off') It works perfectly but I would like to have the option for plotting all the figures in single window. And this code doesn't. I read something

MATLAB subplot margin

允我心安 提交于 2019-12-17 09:32:55
问题 I'm plotting 5 x 3 plots using subplot command, but there are massive margins around each subplot. How do I control the margin size around them? figure; for c=1:15 subplot(5,3,c); imagesc(reshape(image(:,c), 360,480)); colormap gray; axis image; end 回答1: The problem is that Matlab assigns the position property of each axis such that there is space around each plot. You can either adjust the position property, or you can get subaxis from the File Exchange and set up the subplots the way you

Embedding small plots inside subplots in matplotlib

﹥>﹥吖頭↗ 提交于 2019-12-17 02:28:52
问题 If you want to insert a small plot inside a bigger one you can use Axes, like here. The problem is that I don't know how to do the same inside a subplot. I have several subplots and I would like to plot a small plot inside each subplot. The example code would be something like this: import numpy as np import matplotlib.pyplot as plt fig = plt.figure() for i in range(4): ax = fig.add_subplot(2,2,i) ax.plot(np.arange(11),np.arange(11),'b') #b = ax.axes([0.7,0.7,0.2,0.2]) #it gives an error,

Matplotlib adjust image subplots hspace and wspace [duplicate]

依然范特西╮ 提交于 2019-12-14 03:06:00
问题 This question already has answers here : How to remove gaps between *images* in matplotlib? (2 answers) Closed last year . I’m trying to build a figure with 9 image subplots on a 3×3 grid, all sharing X or Y axes, and with no space between adjacent subplots. The following code adds the required axis and collapses the space between them. So far, so good: fig, axes = plt.subplots(ncols=3, nrows=3, sharex=True, sharey=True) fig.subplots_adjust(hspace=0, wspace=0) However, plotting images inside

Python subplots leaving space for common axis labels

陌路散爱 提交于 2019-12-14 01:35:56
问题 I have the following code that makes four subplots in one figure: f = figure( figsize=(7,7) ) f.add_axes([0.2,0.175,0.75,0.75]) f.subplots_adjust(left=0.15) f.clf() ax = f.add_subplot(111) ax1 = f.add_subplot(221) ax2 = f.add_subplot(222) ax3 = f.add_subplot(223) ax4 = f.add_subplot(224) ax.xaxis.set_major_formatter( NullFormatter() ) ax.yaxis.set_major_formatter( NullFormatter() ) ax2.xaxis.set_major_formatter( NullFormatter() ) ax2.yaxis.set_major_formatter( NullFormatter() ) ax1.xaxis.set

ConnectionPatch for 3D subplots

て烟熏妆下的殇ゞ 提交于 2019-12-13 14:26:51
问题 Trying to draw a line connecting a point on a 3D subplot to another 3D subplot. In 2D this is easy to do using ConnectionPatch. I've tried to mimic the Arrow3D class from here without luck. I'm happy for even just a work-around at this point. As an example, in the figure generated by the code below I would want to connect the two green dots. def cylinder(r, n): ''' Returns the unit cylinder that corresponds to the curve r. INPUTS: r - a vector of radii n - number of coordinates to return for