I am new to Tkinter and am working on a GUI based on ML. I want to add a histogram plot from a dataframe into Tkinter and am stuck. This is the histogram plot: This is part of my code Pls suggest the correction. Answer You can save the histogram to an image and then open it and display it
Tag: matplotlib
Linear regression plot on log scale in Python
I want to do linear regression to the data given by x and y. Everything seems to be fine when I use a linear plot, but when I want to plot it on a log scale the line does not look straight. I think I should divide the interval into finer grids rather than only six points. But I couldn’t
How to convert this text file into panda tables to make plots?
Here is an image of the text file: Answer Try using pd.read_csv and some parameters: Content of data.csv:
Draw longest possible vertical line between two curves in seaborn
I currently have a plot like this (consider that data is the dataframe I pasted at the very bottom): Which produces: Now, I want to know how can I annotate a line in this plot, such that it is located between the curves, at the x-Axis value where the distance between curves are maximized. I would also need to annotate
Adding arrows to mpf finance plots
I am trying to add an arrow on a given date and price to mpf plot. To do this i have the following code: But it is producing the following error: Could you please advise how can i resolve this. Answer If your ultimate goal is to add an arrow to the title of the question, you can add it
Generating Scatter Plot from a Matrix
I have a code that generates random matrices of 0’s and 1’s, and I’d like to convert these matrices into scatter plots, where the coordinate corresponds to the matrix row/column, and the color of the scatter point corresponds to the value (red if 0, blue if 1 for example). I’ve been able to do this with matplotlib, but my use-case
Adding custom arrows with labels in seaborn relplot or a facetgrid
I am trying to add two custom arrows with labels in a seaborn relplot graph. I tried using the matplot arrow function which is not working because the seaborne relplot is a “facetgrid”. I did not see a specific arrow pointer function in seaborn docu. I want to draw an arrow at a specific x value between the y values
Closing figures from previous sessions
I am running a python code that produces some figures with Matplotlib and Pandas. After a few runs of the code, I am getting to following error: RuntimeWarning: More than 20 figures have been opened. Figures created through the pyplot interface (matplotlib.pyplot.figure) are retained until explicitly closed and may consume too much memory. (To control this warning, see the rcParam
How to change the number of size categories in seaborn scatterplot
I tried hard to look through all the documentation and examples but I am not able to figure it out. How do I change the number of categories = the number of size bubbles, and their boundaries in seaborn scatterplot? The sizes parameter doesn’t help here. It always gives me 6 of them regardless of what I try (here 8,
Sorted X axis ticks in Matplotlib when using multiple datasets
I have several datasets that I want to plot. The x values are “categorical” strings, in the sense that they have no particularly meaning, but they are sortable (alphanumeric). Each dataset has some X values that are unique, and some that are in common. The desired output is a graph where the xXtick labels are in sorted order. Unfortunately I