matplotlib

How do I choose individual colors for contours in matplotlib

How do I choose individual colors for contours in matplotlib Question: In my short python code below I am plotting risk levels based on values in a csv file and using a shapefile. The code works, but I would like to select specific individual colors for each level, namely green, yellow, orange and red. Currently …

Total answers: 1

mplcursors show data when hover and/or when clicked on datapoint

mplcursors show data when hover and/or when clicked on datapoint Question: is it possible for mplcursors to show data when hover over data point and also when clicked on it on the same plot?i have tried to set both but did not work. below example have 2 plots; first plot have mplcursors to display annotation …

Total answers: 1

TKinter – Column width = 0 leaves yellow pixels

TKinter – Column width = 0 leaves yellow pixels Question: I am trying to only show certain columns when pressing one of the buttons on the right side, for that reason I implemented to hide the other columns by reducing their column width to 0. While this works for hiding the columns, it leaves yellow …

Total answers: 1

How to prevent matplotlib from plotting the "day number" on an axis

How to prevent matplotlib from plotting the "day number" on an axis Question: I am seeing a slightly annoying issue when plotting some data with matplotlib. As shown in the example output below, the x-axis has a slightly unexpected format. The labels are (for example) 04 12:30. The 04 being the day of the month. …

Total answers: 1

matplotlib.path.contains_points inconsistent behavior

matplotlib.path.contains_points inconsistent behavior Question: I have been using matplotlib.path.contains_points() method without any figures or plots. I am getting inconsistent results depending on the path. In the following example, a simple square path works, but a longer path from an ellipse does not: import numpy as np from skimage.draw import ellipse_perimeter from matplotlib.path import Path import …

Total answers: 1

plot multiple lists

plot multiple lists Question: I am Building a GUI by Python and want to plot the the daily bonus of employees depends on the user plotting target: Bob=[100,30,50,90] Sammy=[10,60,90,200] Tom=[70,90,90,90] # input from GUI User is Tom ploting_target=’Tom’ if ploting_target==’Tom’:` plt.plot([0,1,2,3], Tom) elif ploting_target==’Sammy’: plt.plot([0,1,2,3], Sammy) plt.plot([0,1,2,3], Tom) ____________________________________________ #expecting #find_target=list_of_employee.index(ploting_target) #plt(plot([0,1,2,3], list_of_employee[find_target]) Asked By: …

Total answers: 1

How to plot a multidimensional array in a 3D plot?

How to plot a multidimensional array in a 3D plot? Question: I have a multidimensional array (P x N x M) and I want to plot each N x M array in a 3D plot in such a way the P images are stacked along the z-axis. Do you know hw to do this in …

Total answers: 2

how to reformat the x-axis on a chart in matplotlib?

how to reformat the x-axis on a chart in matplotlib? Question: I have a following simple graph in matplotlib: import numpy as np import matplotlib.pyplot as plt data = np.random.uniform(-3, 2, 100) data = np.append(data, [-5, -10, -50, -55]) plt.scatter(range(104), data, marker=’o’, color=’b’, label=’Data Points’) plt.savefig("example.png") Which looks like this: You can see that the …

Total answers: 1

How to plot groups of line plots from multiple files

How to plot groups of line plots from multiple files Question: I have two files one.txt and two.txt which contains two columns and three rows as A.txt A B C 1994 4 6 1996 8 10 1998 10 14 and B.txt as A B C 1995 14 2 1997 18 5 1999 12 9 I …

Total answers: 1

Aren't the values supposed to sum up for each bar?

Aren't the values supposed to sum up for each bar? Question: I was expecting for example the F bar to have 8+9=17 and not only 9 (the last value for F). import matplotlib.pyplot as plt x = [‘A’, ‘B’, ‘C’, ‘D’, ‘D’, ‘D’, ‘D’, ‘E’, ‘F’, ‘F’] y = [ 5 , 8 , 7, …

Total answers: 1