What do you want to save?
Add Code snippet
New code examples
-
Python 2021-11-17 14:42:20
python plot legend
import numpy as np import matplotlib.pyplot as plt x = np.linspace(0, 20, 1000) y1 = np.sin(x) y2 = np.cos(x) plt.plot(x, y1, "-b", label="sine") plt.plot(x, y2, "-r", label="cosine") plt.legend(loc="upper le... Add solution -
Python 2021-11-17 10:43:09
pyplot savefig
import matplotlib.pyplot as plt # creating plotting data xaxis, yaxis =[1, 4, 9, 16, 25, 36, 49, 64, 81, 100], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] # plotting plt.plot(xaxis, yaxis) # saving the file.Make sure you # use savefig() before show(). plt.... Add solution -
Python 2021-11-16 21:48:21
python bubble plot
import matplotlib.pyplot as plt # scatter plot with scatter() function # bubble size with "s" # df dataframe contain columns X, Y, Z variables values plt.scatter('X', 'Y', s='Z', data=df) plt.xlabel("X", size=16) plt.ylabel("y&quo... Add solution -
Python 2021-11-16 14:18:31
plt.legend(
import numpy as np import matplotlib.pyplot as plt x = np.linspace(0, 20, 1000) y1 = np.sin(x) y2 = np.cos(x) plt.plot(x, y1, "-b", label="sine") plt.plot(x, y2, "-r", label="cosine") plt.legend(loc="upper le... Add solution -
Python 2021-11-16 14:14:10
python seaborn violin plot fit data better
# Short answer: # Adjust the bandwidth parameter to smaller values. E.g. bw = 0.1 # Example usage: import numpy as np import seaborn as sns import matplotlib.pyplot as plt data = np.random.rand(100) sns.violinplot(y=data, bw=0.1) # Changing the bw param... Add solution -
Python 2021-11-16 05:52:28
python matplotlib hist set axis range
# Basic syntax: plt.ylim(min,max) plt.xlim(min,max) # Example usage: import matplotlib.pyplot as plt plt.plot(range(5)) plt.xlim(-5, 5) plt.ylim(-5, 5) # Note, this approach is more versatile than using range=[min,max] which # only works in some plots,... Add solution