i created a simple program with Tkinter but i have a small problem i have a graph and i am using .grid() to place it and webar1.get_tk_widget().grid(column=2, row=3, rowspan=20, sticky=”nesw”) the result is: the first result but then when i am aligning it to the left with column 0 like that bar1.get_tk_widget().grid(column=0, row=3, rowspan=20, sticky=”nesw”) the tool bar is centered
Tag: matplotlib
Recenter plot after set_xdata and set_ydata
I can use the set_xdata and set_ydata functions to update an existing matplotlib plot. But after updating I want to recenter the plot so that all the points fall into the “view” of the plot. In the below example, the y data keeps getting bigger but the zoom level of the plot remains same so the data points quickly get
Create a third curve from other two using python
I have two lists of xy coordinates, which I use to plot two curves. I’m interested in the area above the curves, so I used fill_between to arrive at this: Now, what I want is a way to get the coordinates that were not covered by the colored areas, so I can then plot a third curve like the red
(Python) tkinter figures (with colorbar) overlap when using slider
The following codes is to plot contours from five (slider: 0 ~ 4) .xlsx files on tkinter. Each file just contains numerical data in the matrix 12X6 such as When running it, I got Now, if I use fig.clf, for example I got The contour disappeared. I also tried from matplotlib.figure import Figure instead of pyplot; however, it does not
Plot confidence interval of a duration series
I measured the duration of 6000 requests. I got now an Array of 6000 elements. Each element represents the duration of a connection request in milliseconds. [3,2,2,3,4,2,2,4,2,3,3,4,2,4,4,3,3,3,4,3,2,3,5,5,2,4,4,2,2,2,3,5,3,2,2,3,3,3,5,4……..] I want to plot the confidence interval in Python and in a clearly arranged manner. Do you have any Idea how I should plot them? Answer From what I understood this code should
Gaussian curve fitting in physics
I have this data, I tried to fit by a Gaussian function but I can’t found an appropriate function, I tried using curve_fit from scipy.optimize : I used this code : this is the result of this fit : Very bad fit The error message : Answer First, you’re not fitting a Gaussian function, you’re fitting the sum of a
How to change colors for decision tree plot using sklearn plot_tree?
How to change colors in decision tree plot using sklearn.tree.plot_tree without using graphviz as in this question: Changing colors for decision tree plot created using export graphviz? Answer Many matplotlib functions follow the color cycler to assign default colors, but that doesn’t seem to apply here. The following approach loops through the generated annotation texts (artists) and the clf tree
How to plot a line in 3 dimensional space with matplotlib
I have two 3D-points, for example a = (100, 100, 10) and b = (0, 100, 60), and would like to fit a line through those points. I know, the 3D line equation can have different shapes: Vector-form: Parameter-form: But I have a problem getting the data in the right shape for a numerical function. Answer The following code should
is there way to plot graph only for constant data out of mixed data in python?
I am using SIPp tool for sip call that gives me a csv stat file (i configured every 5 sec new row is generated) with columns of current calls (integers) like 0,5,12,25,45,60,60,60,59,60,60,45,32,25,15,5,0. above is with 5 calls per sec with max call limit 60(pls ignore missing values in between). So, this would be my y-axis values. For x-axis (this is
How to assign different palettes to hue levels in a Seaborn barplot?
I’m using Seaborn to create bar plots in Python. I have a 2 (attention: divided vs focused) X 3 (solutions: 1,2,3) design. For divided, I want the bar colors to be darkred, darkgreen, darkblue. For focused, I want the bar colors to be red, green, blue. This code doesn’t work because the palette only applies to the hue parameter: This