matplotlib

How to use matplotlib set_yscale

妖精的绣舞 提交于 2021-02-07 15:34:53
问题 I am plotting a function with Matplotlib, and I would like to set the y-axis to log-scale. However, I keep getting an error using set_yscale() . After setting values for my x values and y values, I write import matplotlib as plt plot1 = plt.figure() plt.plot(x, y) plt.set_xscale("log") This results in the error: AttributeError: 'module' object has no attribute 'set_xscale' So, I try plot1 = plt.figure() plt.plot(x, y) plt.set_xscale("log") I get the same error. How do you call this function?

How to use matplotlib set_yscale

送分小仙女□ 提交于 2021-02-07 15:33:46
问题 I am plotting a function with Matplotlib, and I would like to set the y-axis to log-scale. However, I keep getting an error using set_yscale() . After setting values for my x values and y values, I write import matplotlib as plt plot1 = plt.figure() plt.plot(x, y) plt.set_xscale("log") This results in the error: AttributeError: 'module' object has no attribute 'set_xscale' So, I try plot1 = plt.figure() plt.plot(x, y) plt.set_xscale("log") I get the same error. How do you call this function?

How to use matplotlib set_yscale

梦想的初衷 提交于 2021-02-07 15:33:16
问题 I am plotting a function with Matplotlib, and I would like to set the y-axis to log-scale. However, I keep getting an error using set_yscale() . After setting values for my x values and y values, I write import matplotlib as plt plot1 = plt.figure() plt.plot(x, y) plt.set_xscale("log") This results in the error: AttributeError: 'module' object has no attribute 'set_xscale' So, I try plot1 = plt.figure() plt.plot(x, y) plt.set_xscale("log") I get the same error. How do you call this function?

Conditional formatting for 2- or 3-scale coloring of cells of a table

那年仲夏 提交于 2021-02-07 14:45:56
问题 I would like to output a simple table to a PDF file with some conditional formatting of 2- or 3-scale coloring of cells dependent on the value. Like the red-white-green color scaling in Microsoft Excel conditional formatting option. import pandas import numpy as np df = pandas.DataFrame(np.random.randn(10, 2), columns=list('ab')) print df #Output: a b 0 -1.625192 -0.949186 1 -0.089884 0.825922 2 2.117651 -0.046258 3 -0.921751 -0.144447 4 -0.294095 -1.774725 5 -0.780523 -0.435909 6 0.544958 0

Conditional formatting for 2- or 3-scale coloring of cells of a table

旧巷老猫 提交于 2021-02-07 14:45:40
问题 I would like to output a simple table to a PDF file with some conditional formatting of 2- or 3-scale coloring of cells dependent on the value. Like the red-white-green color scaling in Microsoft Excel conditional formatting option. import pandas import numpy as np df = pandas.DataFrame(np.random.randn(10, 2), columns=list('ab')) print df #Output: a b 0 -1.625192 -0.949186 1 -0.089884 0.825922 2 2.117651 -0.046258 3 -0.921751 -0.144447 4 -0.294095 -1.774725 5 -0.780523 -0.435909 6 0.544958 0

Force background of matplotlib figure to be transparent

余生长醉 提交于 2021-02-07 14:44:26
问题 I'm trying to include a matplotlib figure in a Python Gtk3 application I'm writing. I'd like to set the background colour of the figure to be transparent, so that the figure just shows up against the natural grey background of the application, but nothing I've tried so far seems to be working. Here's an MWE: from gi.repository import Gtk import matplotlib.pyplot as plt import matplotlib.lines as mlines import numpy as np from matplotlib.backends.backend_gtk3agg import FigureCanvasGTK3Agg as

Force background of matplotlib figure to be transparent

橙三吉。 提交于 2021-02-07 14:44:25
问题 I'm trying to include a matplotlib figure in a Python Gtk3 application I'm writing. I'd like to set the background colour of the figure to be transparent, so that the figure just shows up against the natural grey background of the application, but nothing I've tried so far seems to be working. Here's an MWE: from gi.repository import Gtk import matplotlib.pyplot as plt import matplotlib.lines as mlines import numpy as np from matplotlib.backends.backend_gtk3agg import FigureCanvasGTK3Agg as

Conditional formatting for 2- or 3-scale coloring of cells of a table

和自甴很熟 提交于 2021-02-07 14:44:25
问题 I would like to output a simple table to a PDF file with some conditional formatting of 2- or 3-scale coloring of cells dependent on the value. Like the red-white-green color scaling in Microsoft Excel conditional formatting option. import pandas import numpy as np df = pandas.DataFrame(np.random.randn(10, 2), columns=list('ab')) print df #Output: a b 0 -1.625192 -0.949186 1 -0.089884 0.825922 2 2.117651 -0.046258 3 -0.921751 -0.144447 4 -0.294095 -1.774725 5 -0.780523 -0.435909 6 0.544958 0

Force background of matplotlib figure to be transparent

偶尔善良 提交于 2021-02-07 14:43:19
问题 I'm trying to include a matplotlib figure in a Python Gtk3 application I'm writing. I'd like to set the background colour of the figure to be transparent, so that the figure just shows up against the natural grey background of the application, but nothing I've tried so far seems to be working. Here's an MWE: from gi.repository import Gtk import matplotlib.pyplot as plt import matplotlib.lines as mlines import numpy as np from matplotlib.backends.backend_gtk3agg import FigureCanvasGTK3Agg as

Seaborn/Matplotlib: how to access line values in FacetGrid?

 ̄綄美尐妖づ 提交于 2021-02-07 14:27:29
问题 I'm trying to shade the area between two lines in a Seaborn FacetGrid. The fill_between method will do this, but I need to access the values of each line in each subplot to pass them in. Here's my code: import pandas as pd import matplotlib.pyplot as plt import seaborn as sns data = [{'Change': 0.0, 'Language': 'Algonquin', 'Type': 'Mother tongue', 'Year': '2011'}, {'Change': 0.0, 'Language': 'Algonquin', 'Type': 'Spoken at home', 'Year': '2011'}, {'Change': -21.32, 'Language': 'Algonquin',