axes

Matplotlib sharex not working as expected

让人想犯罪 __ 提交于 2020-08-10 22:54:05
问题 I'm sure I am missing something obvious, but why is sharex=True, sharey=True not working? I expected the xlims and xticks to be the same for both subplots, and the ylims/yticks to be the same for both subplots. Using Python 3.8.3, matplotlib 3.2.1. x1, y1 = [(2,7,1), (6,2,2)] x2, y2 = [(8,3,0), (1,4,9)] fig, ax = plt.subplots(2,1, sharex=True, sharey=True, figsize=(15, 8)); ax1 = plt.subplot(2,1,1); ax1.scatter(x1, y1, c='red', label='Set1'); ax2 = plt.subplot(2,1,2); ax2.scatter(x2, y2, c=

Matplotlib sharex not working as expected

对着背影说爱祢 提交于 2020-08-10 22:52:13
问题 I'm sure I am missing something obvious, but why is sharex=True, sharey=True not working? I expected the xlims and xticks to be the same for both subplots, and the ylims/yticks to be the same for both subplots. Using Python 3.8.3, matplotlib 3.2.1. x1, y1 = [(2,7,1), (6,2,2)] x2, y2 = [(8,3,0), (1,4,9)] fig, ax = plt.subplots(2,1, sharex=True, sharey=True, figsize=(15, 8)); ax1 = plt.subplot(2,1,1); ax1.scatter(x1, y1, c='red', label='Set1'); ax2 = plt.subplot(2,1,2); ax2.scatter(x2, y2, c=

Matplotlib sharex not working as expected

旧街凉风 提交于 2020-08-10 22:51:59
问题 I'm sure I am missing something obvious, but why is sharex=True, sharey=True not working? I expected the xlims and xticks to be the same for both subplots, and the ylims/yticks to be the same for both subplots. Using Python 3.8.3, matplotlib 3.2.1. x1, y1 = [(2,7,1), (6,2,2)] x2, y2 = [(8,3,0), (1,4,9)] fig, ax = plt.subplots(2,1, sharex=True, sharey=True, figsize=(15, 8)); ax1 = plt.subplot(2,1,1); ax1.scatter(x1, y1, c='red', label='Set1'); ax2 = plt.subplot(2,1,2); ax2.scatter(x2, y2, c=

matplotlib axis('tight') doesn't work?

杀马特。学长 韩版系。学妹 提交于 2020-07-15 07:55:11
问题 According to the documentation, ax.autoscale(tight=True) should If True, set view limits to data limits; With ax.axis('tight') being similar: ‘tight’ Limits set such that all data is shown (sic) And we even see that it works in the screenshots of this question. But no matter what I try, it doesn't seem to work with the following simple example. Here's what I typed into jupyter-qtconsole : In [27]: f, ax = plt.subplots(1) In [28]: ax.plot([0, 1], [1, 0]) Out[28]: [<matplotlib.lines.Line2D at

matplotlib axis('tight') doesn't work?

拈花ヽ惹草 提交于 2020-07-15 07:54:08
问题 According to the documentation, ax.autoscale(tight=True) should If True, set view limits to data limits; With ax.axis('tight') being similar: ‘tight’ Limits set such that all data is shown (sic) And we even see that it works in the screenshots of this question. But no matter what I try, it doesn't seem to work with the following simple example. Here's what I typed into jupyter-qtconsole : In [27]: f, ax = plt.subplots(1) In [28]: ax.plot([0, 1], [1, 0]) Out[28]: [<matplotlib.lines.Line2D at

Horizontal colorbar over 2 of 3 subplots

╄→гoц情女王★ 提交于 2020-06-22 12:10:35
问题 does someone know how to elegantly draw a horizontal colorbar over two of three subplots and one additional horizontal colorbar over the third subplot. Ideally, the colorbars should have the same x-dimensions as the corresponding image axis. I did not find any nice solution, except setting up an entire image grid using matplotlib.gridspec . Drawing single colorbars works perfectly fine with mpl_toolkits.axes_grid1.ImageGrid , but it fails when trying to draw a colorbar over two of three axes.

matplotlib: AttributeError: 'AxesSubplot' object has no attribute 'add_axes'

自古美人都是妖i 提交于 2020-06-11 17:01:07
问题 Not sure exactly sure how to fix the following attribute error: AttributeError: 'AxesSubplot' object has no attribute 'add_axes' The offending problem seems to be linked to the way I have set up my plot: gridspec_layout = gridspec.GridSpec(3,3) pyplot_2 = fig.add_subplot(gridspec_layout[2]) ax = WCSAxes(fig, [0.1, 0.1, 0.8, 0.8], wcs=wcs) pyplot_2.add_axes(ax) Does anybody know how to solve this? Many thanks. 回答1: There's not much details to go on in your question but I'll wager a guess. The

matplotlib: AttributeError: 'AxesSubplot' object has no attribute 'add_axes'

 ̄綄美尐妖づ 提交于 2020-06-11 16:59:32
问题 Not sure exactly sure how to fix the following attribute error: AttributeError: 'AxesSubplot' object has no attribute 'add_axes' The offending problem seems to be linked to the way I have set up my plot: gridspec_layout = gridspec.GridSpec(3,3) pyplot_2 = fig.add_subplot(gridspec_layout[2]) ax = WCSAxes(fig, [0.1, 0.1, 0.8, 0.8], wcs=wcs) pyplot_2.add_axes(ax) Does anybody know how to solve this? Many thanks. 回答1: There's not much details to go on in your question but I'll wager a guess. The

Force the origin to start at 0 without margin between data and x axis in new ggplot theme

。_饼干妹妹 提交于 2020-05-27 06:20:32
问题 Based on this question Force the origin to start at 0 I want to implement this into a new created theme and not just as a default setting. data(iris) ggplot(iris, aes(x = Species)) + geom_bar() + scale_y_continuous(expand = expansion(mult = c(0, 0.05))) How can I do this without defining it every single plot? 回答1: As far as I know this not possible via theme() . But you can define a wrapper around scale_y_continuous like so library(ggplot2) data(iris) scale_y_origin <- function(...) { scale_y

Is there a way to normalize the scales of axes in subplots in cufflinks library python?

你。 提交于 2020-04-30 08:47:09
问题 I have used cufflinks to plot a few subplots, their scale ranges are different. I want same scales so I can compare the subplots. Is there a way to customize the axes of each subplot in cufflinks? This link shows the picture of the subplots, the subplots of row 1, column1 and column2 have different ranges on the y axes. Is there a way to change the range of graph DRV.FV to -5 to 10? MCVE: df=cf.datagen.lines(4) df.iplot(subplots=True, subplot_titles=True, legend=False) I have taken this from