matplotlib

Matplotlib: how to load and show a PDF image

拟墨画扇 提交于 2021-01-27 03:58:05
问题 My problem is simple: I have a PDF figure I would like to show alongside the results of some data analysis. Yet even an extensive Google search did not bring up a way to load and show a PDF in a figure (I only found the standard results for raster images like JPG or PNG). Thanks in advance! 回答1: I don't think Matplotlib supports plotting imported vector graphics on its own as of today. The easiest approach would probably be to save your figure generated in Matplotlib to SVG, convert your PDF

Sharing a yaxis label with two of three subplots in pyplot

拥有回忆 提交于 2021-01-27 02:57:28
问题 I have the following code which produces the plot shown. mport matplotlib.pyplot as plt import matplotlib.gridspec as gridspec import numpy as np One = range(1,10) Two = range(5, 14) l = len(One) fig = plt.figure(figsize=(10,6)) gs = gridspec.GridSpec(3, 1, height_ratios=[5, 3, 3]) ax0 = plt.subplot(gs[0]) ax0.bar(range(l), Two) plt.ylabel("Number of occurrence") ax1 = plt.subplot(gs[1], sharey=ax0) ax1.bar(range(l), Two) ax2 = plt.subplot(gs[2]) ax2.bar(range(l), One) plt.show() I want the

Sharing a yaxis label with two of three subplots in pyplot

ぐ巨炮叔叔 提交于 2021-01-27 02:56:41
问题 I have the following code which produces the plot shown. mport matplotlib.pyplot as plt import matplotlib.gridspec as gridspec import numpy as np One = range(1,10) Two = range(5, 14) l = len(One) fig = plt.figure(figsize=(10,6)) gs = gridspec.GridSpec(3, 1, height_ratios=[5, 3, 3]) ax0 = plt.subplot(gs[0]) ax0.bar(range(l), Two) plt.ylabel("Number of occurrence") ax1 = plt.subplot(gs[1], sharey=ax0) ax1.bar(range(l), Two) ax2 = plt.subplot(gs[2]) ax2.bar(range(l), One) plt.show() I want the

Show only selected or specific matplotlib figures

北城余情 提交于 2021-01-27 02:27:22
问题 I am generating a total of 50+ figures but I do not wish to display them all. I would like to pick out the figures that I want to display. Is there any way to do it? For example: I have 50 plots which are generated over the course of the program. At the end, when I enter plt.show(), it shows all the figures. However, I would like to display only 3 or 4 figures (but they aren't fixed i.e, I could plot figures 1, 2, 3, 4 at one time and another time I could plot figures 10, 27, 33, 45). Also, a

Matplotlib Table- Assign different text alignments to different columns

岁酱吖の 提交于 2021-01-26 19:14:07
问题 I am creating a two column table and want the text to be as close as possible. How can I specify that the first column be right aligned and the second be left aligned? I've tried by setting the general cellloc to one side (cellloc sets the text alignment) from matplotlib import pyplot as plt data = [['x','x'] for x in range(10)] bbox = [0,0,1,1] tb = plt.table(cellText = data, cellLoc='right', bbox = bbox) plt.axis('off') # get rid of chart axis to only show table Then looping through cells

Matplotlib Table- Assign different text alignments to different columns

試著忘記壹切 提交于 2021-01-26 19:12:37
问题 I am creating a two column table and want the text to be as close as possible. How can I specify that the first column be right aligned and the second be left aligned? I've tried by setting the general cellloc to one side (cellloc sets the text alignment) from matplotlib import pyplot as plt data = [['x','x'] for x in range(10)] bbox = [0,0,1,1] tb = plt.table(cellText = data, cellLoc='right', bbox = bbox) plt.axis('off') # get rid of chart axis to only show table Then looping through cells

Matplotlib Table- Assign different text alignments to different columns

夙愿已清 提交于 2021-01-26 19:11:18
问题 I am creating a two column table and want the text to be as close as possible. How can I specify that the first column be right aligned and the second be left aligned? I've tried by setting the general cellloc to one side (cellloc sets the text alignment) from matplotlib import pyplot as plt data = [['x','x'] for x in range(10)] bbox = [0,0,1,1] tb = plt.table(cellText = data, cellLoc='right', bbox = bbox) plt.axis('off') # get rid of chart axis to only show table Then looping through cells

Matplotlib Table- Assign different text alignments to different columns

强颜欢笑 提交于 2021-01-26 19:11:14
问题 I am creating a two column table and want the text to be as close as possible. How can I specify that the first column be right aligned and the second be left aligned? I've tried by setting the general cellloc to one side (cellloc sets the text alignment) from matplotlib import pyplot as plt data = [['x','x'] for x in range(10)] bbox = [0,0,1,1] tb = plt.table(cellText = data, cellLoc='right', bbox = bbox) plt.axis('off') # get rid of chart axis to only show table Then looping through cells

Matplotlib Table- Assign different text alignments to different columns

一世执手 提交于 2021-01-26 19:11:12
问题 I am creating a two column table and want the text to be as close as possible. How can I specify that the first column be right aligned and the second be left aligned? I've tried by setting the general cellloc to one side (cellloc sets the text alignment) from matplotlib import pyplot as plt data = [['x','x'] for x in range(10)] bbox = [0,0,1,1] tb = plt.table(cellText = data, cellLoc='right', bbox = bbox) plt.axis('off') # get rid of chart axis to only show table Then looping through cells

How plot datetime.time in matplotlib?

浪子不回头ぞ 提交于 2021-01-26 03:54:55
问题 I have two arrays I want to display : x : [datetime.time(0, 17, 47, 782000), ...ect y : [1712, 2002, ...ect I'm trying to convert x to the format used by matplotlib but it never woks x = [matplotlib.dates.date2num(i) for i in x] But I get this error AttributeError: 'datetime.time' object has no attribute 'toordinal' My problem is linked with the time format : The raw info is like this : 00:04:49.251 Then I convert it datetime.datetime.strptime(string, "%H:%M:%S.%f").time() So the type is