I’m trying to use the convenience of the plot method of a pandas dataframe while adjusting the size of the figure produced. (I’m saving the figures to file as well as displaying them inline in a Jupyter notebook). I found the method below successful most of the time, except when I plot two lines on the same chart – then
Tag: plot
How to customize and add extra elements to Sympy plots?
I have a few questions about what how to work with graphics, using Sympy. My code: 1) The graph is obtained stretched along the x axis. How to make so that the curve looked like a circle? 2) How to add other elements to the chart. For example, the point O(0, 0) and the line y = x. Answer According
How to plot multiple lines in one figure in Pandas Python based on data from multiple columns? [duplicate]
This question already has answers here: Plotting multiple lines, in different colors, with pandas dataframe (6 answers) Closed 1 year ago. I have a dataframe with 3 columns, like this: how can I plot a line for A, B and C, where it shows how their weight develops through the years. So I tried this: However, I get multiple plots
Visualize an RDFLIB Graph in Python
I am new to RDFLIB in python. I found this example of creating a graph on here. What is the simplest way to visualize graph created by this code? I see that the rdflib package has a tools component that has a function called rdfs2dot. How can I use this function to display a plot with the RDF graph in
How to move the legend in Seaborn FacetGrid outside of the plot
I have the following code: This results in the following plot: How can I move the legend outside of the plot? Answer According to mwaskom’s comment above, this is a bug in OS X. Indeed switching to another backend solves the issue. For instance, I put this into my matplotlibrc:
Dealing with masked coordinate arrays in pcolormesh
I’m working on visualizing some climate model output. The computation is done on a projected latitude/longitude grid. Since the model is simulating sea ice, all land grid cells are masked. The standard tools for plotting geographical information in Python are Basemap and Cartopy, both of which use matplotlib routines. In particular, pcolormesh is the obvious choice for plotting. If there
How to plot multiple linear regressions in the same figure
Given the following: This will create 2 separate plots. How can I add the data from df2 onto the SAME graph? All the seaborn examples I have found online seem to focus on how you can create adjacent graphs (say, via the ‘hue’ and ‘col_wrap’ options). Also, I prefer not to use the dataset examples where an additional column might
Python Scatter Plot with Multiple Y values for each X
I am trying to use Python to create a scatter plot that contains two X categories “cat1” “cat2” and each category has multiple Y values. I can get this to work if the number of Y values for each X value is the same by using this following code: but as soon as the number of Y values for each
Install Plotly in Anaconda
How to install Plotly in Anaconda? The https://conda.anaconda.org/plotly says to conda install -c https://conda.anaconda.org/plotly <package>, and The https://plot.ly/python/user-guide/ says to pip install plotly. I.e., without package. So which packages I should specify in Anaconda conda? I tried without one and get errors: Answer If you don’t care which version of Plotly you install, just use pip. pip install plotly is
Plotting a NACA 4-series airfoil
I’m trying to plot an airfoil from the formula as described on this wikipedia page. This Jupyter notebook can be viewed on this github page. The result looks like . I expected it to look more like . Questions: Why is the line not completely smooth? There seems to be a discontinuity where the beginning and end meet. Why does