subplot

Matplotlib/Pyplot shared axis for odd number of subplots

对着背影说爱祢 提交于 2019-12-13 04:31:46
问题 I am using the following code to produce an odd number of plots that I want 'butted' together and sharing axes. import matplotlib.pyplot as plt fig = plt.figure() ax1 = fig.add_subplot(4,2,1) ax1.set_yscale('log') ax1.set_xscale('log') plt.subplot(4,2,2, sharex=ax1, sharey=ax1) plt.subplot(4,2,3, sharex=ax1, sharey=ax1) plt.subplot(4,2,4, sharex=ax1, sharey=ax1) plt.subplot(4,2,5, sharex=ax1, sharey=ax1) plt.subplot(4,2,6, sharex=ax1, sharey=ax1) plt.subplot(4,2,7, sharex=ax1, sharey=ax1) plt

Place multiple plots into one big axis at specific coordinates

走远了吗. 提交于 2019-12-13 03:46:14
问题 I am trying to put multiple matplotlib subplots into a big axis, where tick labels on the big axis correspond to some parameter values for which the data in each subplot has been obtained. Here's an example, import matplotlib.pyplot as plt data = {} data[(10, 10)] = [0.45, 0.30, 0.25] data[(10, 20)] = [0.2, 0.5, 0.3] data[(20, 10)] = [0.1, 0.3, 0.6] data[(20, 20)] = [0.6, 0.15, 0.25] data[(30, 10)] = [0.4, 0.35, 0.25] data[(30, 20)] = [0.5, 0.1, 0.4] # x and y coordinates for the big plot x

Matlab: Overlapping subplot titles

喜你入骨 提交于 2019-12-13 02:23:29
问题 I'm using subplot which contains three different plots. Each plot has its own labels and title. The problem is that I have to maximize the plot when I save it. Otherwise, the texts will overlap each other. When I maximize it, the subplot's label text will appear little blurry in the image, even if I use ESP format or any vector format. How can I resolve this issue? 回答1: For the title overlap issues, you can produce multiple lines of title text use a cell array of strings as the input

Creating a subplot below a plot with an inset graph in python

那年仲夏 提交于 2019-12-13 01:25:17
问题 I currently have the graph attached. I want a separate graph underneath this one showing the difference between the two lines to visually show the functional approach to error analysis. How do I add a subplot below this graph with a space and new axes without effecting the size and shape of my current graph. My current code is: fig, ax = plt.subplots() plt.plot(x, y1, label = 'label1') plt.plot(x, y2, label = 'label2') plt.plot(x, y3, label = 'label2') plt.xlabel(u'Redshift (z)', fontname =

How to run a smart loop for subplots in python

点点圈 提交于 2019-12-12 21:50:44
问题 So I'm trying to create a 3x3 box of 9 graphs, and while I've managed to do it by manually writing the code for each individual box, I want to learn how to do it using a loop. I can't seem to figure it out. Currently, I'm using the following: from matplotlib import gridspec f, ((ax1, ax2, ax3), (ax4, ax5, ax6), (ax7, ax8, ax9)) = plt.subplots(3, 3, sharex='col', sharey='row') gs = gridspec.GridSpec(3, 3) fig = plt.figure(figsize=(20,20)) fig.text(0.5, .95, 'Constant Slope for [O/Fe]/[Fe/H]

Julia: How to create subplots with different sizes using PyPlot?

送分小仙女□ 提交于 2019-12-12 21:24:50
问题 I want to create a figure that contains multiple plots. However I want to be able to make each plot have a different size. For example, I want the first subplot to be approximately twice as wide as the second subplot. I was hoping to do something like this: using PyPlot a = rand(500,900) b = rand(500,400) # notice how 'a' is 900 in width and 'b' is 400, i.e. 'a' is approximately twice as wide as 'b' figure(1) subplot(2,5,1:2) ; imshow(a) subplot(2,5,3) ; imshow(b) # and so on... But this

Using groupy and subplots with pandas dataframe

走远了吗. 提交于 2019-12-12 04:11:18
问题 I have a dataframe object with time series data in multiple columns (see below). I am trying to make a graphic with subplots for each of the columns in the dataframe where each subplot has 12 boxplots, one for each month. I have used the following code to just make subplots from a dataframe before (but for bar not boxplots), labels = df.columns.values fig, axes = plt.subplots(nrows = 3, ncols = 4, gridspec_kw = dict(hspace=0.3),figsize=(12,9), sharex = True, sharey=True) targets = zip(labels,

How to add specific axes to matplotlib subplot?

笑着哭i 提交于 2019-12-12 03:37:25
问题 I am trying to make a matrix plot with matplotlib. The individual plots are made with a specific module windrose which subclasses PolarAxes . However there does not seem to be any projection defined in the module to be called as subplot kwargs. The standard polar projection does not work since some of the subclass arguments are missing. I have tested several approaches without success (even with seaborn map considering this post: https://stackoverflow.com/a/25702476/3416205). Hereunder is the

How to implement automatic color change in matplotlib with subplots?

三世轮回 提交于 2019-12-11 19:49:31
问题 I am drawing charts with matplotlib. When i am drawing it at the same chart with this code: def draw0(x, ys, labels): plt.suptitle("big title") i =0 for y in ys: plt.plot(x, y, label=labels[i]) plt.scatter(x, y) # dots plt.xticks(range(1, max(x) + 1)) plt.grid(True) i+=1 plt.figlegend(loc="upper left") plt.show() return x = [1,2,3,4,5] y1 = [1,3,5,7,9] y2 = [10,30,50,70,90] y3 = [0.1,0.3,0.5,0.7,0.9] draw0(x, [y1, y2, y3], ["chart1", "chart2", "chart3"]) everything works fine. charts in one

Aggregate several AxesSubplot after multiprocessing to draw a matplotlib figure

↘锁芯ラ 提交于 2019-12-11 15:13:51
问题 I'm trying to create a subplot of several pcolormesh graphs that would be like this one: I achieve to do this by computing on one process: import matplotlib.pyplot as plt import numpy as np def create_spectrogram(data, x, y, ax): ax.pcolormesh(x, y, data) def do_it_simple(): size = 10 data = np.arange(size * size).reshape((size, size)) y = np.arange(0, 10) x = np.arange(0, 10) fig, axes = plt.subplots(nrows=2, ncols=5) axes_list = [item for sublist in axes for item in sublist] for ax in axes