10 examples of 'save plot python' in Python

Every line of 'save plot python' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
this disclaimer
206def save(self, name):
207 self.fig.savefig(''.join((name, '.png')), dpi=300)
Important

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code

49def save_on_disk(plot):
50 plot.savefig("image.png")
344def save(self, filepath, **kwargs):
345 """Saves the plot to a file.
346
347 Parameters
348 ----------
349 filepath : str
350 Full path of the file.
351
352 Notes
353 -----
354 For an overview of all configuration options, see [1]_.
355
356 References
357 ----------
358 .. [1] https://matplotlib.org/2.0.2/api/pyplot_api.html#matplotlib.pyplot.savefig
359
360 """
361 self.axes.autoscale()
362 plt.savefig(filepath, **kwargs)
112def save(self, name="geodesic.png"):
113 """
114 Method to save plots locally.
115
116 Parameters
117 ----------
118 name : str, optional
119 Name of the file with extension.
120 """
121 basename, ext = os.path.splitext(name)
122 saveplot(self.fig, image=ext[1:], image_filename=basename, show_link=False)
135def save_plot(self, filename, img_format="eps", **kwargs):
136 """
137 Save matplotlib plot to a file.
138
139 Args:
140 filename: Filename to write to.
141 img_format: Image format to use. Defaults to EPS.
142 """
143 plt = self.get_plot(**kwargs)
144 plt.savefig(filename, format=img_format)
4def ggsave(plot, filename, width=None, height=None):
5 plot.make()
6 w, h = plot.fig.get_size_inches()
7 if width:
8 w = width
9 if height:
10 h = height
11 plot.fig.set_size_inches(w, h)
12 plot.fig.savefig(filename)
796def save_plot(self, filename: str, **kwargs):
797 """Save the image plot to file."""
798 self.plot(show=False)
799 plt.savefig(filename, **kwargs)
106def save_state(self, save_data=False):
107 """Return a serialized representation of the PlotData for saving to disk"""
108 pds = {}
109 pds['data_source'] = [self._parent.hostname, self._parent.port, self._parent.ssh_tunnel]
110 if(save_data):
111 pds['x'] = self.x.save_state()
112 pds['y'] = self.y.save_state()
113 pds['l'] = self.l.save_state()
114 pds['title'] = self.title
115 pds['group'] = self.group
116 pds['maxlen'] = self.maxlen
117 pds['recordhistory'] = self.recordhistory
118 return pds
16def plot_using_plotly(title,traces,filename):
17 data = Data(traces)
18 layout = {
19 "autosize": True,
20 "height": 1000,
21 "showlegend": True,
22 "title": title,
23 "width": 2000,
24 "xaxis": {
25 "autorange": True,
26 "title": "Time (days)",
27 },
28 "yaxis": {
29 "autorange": True,
30 "title": "Token Amount"
31 },
32 "yaxis2":{
33 "title":'Price(USD)',
34 "overlaying":'y',
35 "side":'right'
36 }
37 }
38 fig = Figure(data=data, layout=layout)
39 plot_url = plot_helper(fig,filename)
40
41 print(title + " --- " + plot_url)
42 return plot_url
254def save_plot(test,predicted, file_name):
255 plt.plot(test, color='red',label='Real Stock Price')
256 plt.plot(predicted, color='blue',label='Predicted Stock Price')
257 plt.title('Stock Price Prediction')
258 plt.xlabel('Time')
259 plt.ylabel('Stock Price')
260 plt.legend()
261 plt.savefig(file_name + '.jpg')

Related snippets