matplotlib

Why does one Python script raise a qt.qpa.plugin error, while another identical script does not?

痴心易碎 提交于 2021-01-29 08:10:20
问题 I have two virtually identical scripts running in the same PyCharm IDE. They both call into a third script that uses matplotlib to output a Numpy array to a PNG. One of the scripts works fine and outputs the PNG. The other script raises the following error: qt.qpa.plugin: Could not load the Qt platform plugin "windows" in "" even though it was found. The differences between the scripts are minimal - they only vary in that they each import a different pytorch model (both models created by me).

NetworkX: color code edges based on node color

£可爱£侵袭症+ 提交于 2021-01-29 08:04:32
问题 I created a networkX weighted graph (refer to this question for the code) and I wanted to color code the edges based on node color. If two nodes are of the same color and connected I want their edge color to be one color, say red. Moreover, if the nodes aren't the same color but connected I want them to be a different color, say blue. Is there a way I could achieve this? The code for the edges is as follows: for edge in G.edges(): source, target = edge rad = 0.35 arrowprops=dict(lw=G.edges[

Matplotlib - _tkinter.TclError: bad screen distance “320.0” [closed]

五迷三道 提交于 2021-01-29 07:44:48
问题 This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. Closed 8 years ago . File "main.py", line 52, in <module> r2n(name) File "C:\Users\Riki\Documents\Universita\Erasmus\Personalization and Metadata modeling 02817\Final Project

Why doesn't adjusting scilimits in matplotlib work properly?

北慕城南 提交于 2021-01-29 07:37:50
问题 I am trying to make a plot with the same scilimits using the following code: from matplotlib import rc rc('text', usetex=True) plt.rcParams['text.latex.preamble']=[r"\usepackage{amsmath}"] plt.figure(figsize=(8, 8)) aaaa = [64673.753739998487, 47600.685099333175, 103536.00001368104, 72449.921543225209, 61508.505984112242, 70263.491595277388, 54348.281891183826, 49961.598403993477, 33835.286137921314, 34182.104988390645, 35539.090978564935, 69718.606491298371, 64032.096678612936, 52855

Matplotlib - _tkinter.TclError: bad screen distance “320.0” [closed]

好久不见. 提交于 2021-01-29 07:31:18
问题 This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. Closed 8 years ago . File "main.py", line 52, in <module> r2n(name) File "C:\Users\Riki\Documents\Universita\Erasmus\Personalization and Metadata modeling 02817\Final Project

Plot through time setting specific filtering [closed]

独自空忆成欢 提交于 2021-01-29 07:30:43
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 3 months ago . Improve this question I have a dataset like this: Freq Date 01-11 1 05-11 1 04-10 1 02-12 1 12-10 1 ... ... 07-20 286 06-20 288 05-20 390 04-20 471 03-20 510 I would like to plot the frequency by month, to create 12 plots one per each month, showing the frequency through through

Multiple plots with matplotlib in Python

旧巷老猫 提交于 2021-01-29 07:21:05
问题 I'm to Python and learning it by doing. I want to make two plots with matplotlib in Python. The second plot keeps the limits of first one. Wonder how I can change the limits of each next plot from previous. Any help, please. What is the recommended method? X1 = [80, 100, 120, 140, 160, 180, 200, 220, 240, 260] Y1 = [70, 65, 90, 95, 110, 115, 120, 140, 155, 150] from matplotlib import pyplot as plt plt.plot( X1 , Y1 , color = "green" , marker = "o" , linestyle = "solid" ) plt.show() X2 = [80,

How to plot multiple seaborn.distplot in a single figure

吃可爱长大的小学妹 提交于 2021-01-29 07:19:25
问题 I want to plot multiple seaborn distplot under a same window, where each plot has the same x and y grid. My attempt is shown below, which does not work. # function to plot the density curve of the 200 Median Stn. MC-losses def make_density(stat_list,color, layer_num): num_subplots = len(stat_list) ncols = 3 nrows = (num_subplots + ncols - 1) // ncols fig, axes = plt.subplots(ncols=ncols, nrows=nrows, figsize=(ncols * 6, nrows * 5)) for i in range(len(stat_list)): # Plot formatting plt.title(

Python matplotlib - errorbar None values in series

放肆的年华 提交于 2021-01-29 07:12:02
问题 I was trying to plot a series with error bars. The series may contain None values. When not using the errors - the series is plotted with no error. When trying to plot with the error bars - I get this error: My code is: x = [10.4, 11.12,11.3,None, 10.2,11.3] y = [0.3, 1.2, 0.7, None, 1.1, 0.4] y_err = [0.01, 0.04, 0.07, None, 0.01, 0.05] plt.plot(x,y, 'o', color='r') # this one works. I get a plot with 5 points. The null point is skipped plt.errorbar(x,y,yerr=y_err) # this one doesn't work

Matplotlib: How to change colorbar gradient using user input

巧了我就是萌 提交于 2021-01-29 07:09:19
问题 I want to customize the colorbar(colormap) with specific value range. The color range should varies with the given parameter (Tup,Tmd,Tbt) where Tup: User selected Upper value Tmid: User selected Mid Point Tbt:User selected bottom point Mid color (lime) should range through user selected Tup and Tbt with Tmd as a mid-point. I tried to generate custom colormap using below code snippet, but could not able to control its range using user provided values. cmap = LinearSegmentedColormap.from_list(