Difference between revisions of "Plot Workbench/pt"

From FreeCAD Documentation
Jump to navigation Jump to search
(Created page with "Bancada de trabalho Plot")
 
(Updating to match new version of source page)
 
(14 intermediate revisions by 2 users not shown)
Line 1: Line 1:
The Plot module allows to edit and save output plots created from other modules and tools. With plot module you can edit easily the working area, the axes, labels, titles, styles, etc. Plot module is an abstraction of matplotlib conveniently addapted to FreeCAD.
+
<languages/>
  
==Tools==
+
[[Image:Workbench_Plot.svg|thumb|128px|Plot workbench icon]]
  
These are tools availables.
+
{{TOCright}}
* [[Image:Plot_Save.png|32px]] [[Plot_Save|Save plot]]: Saves the plot in several formats. You can select the output size and resolution too.
+
 
* [[Image:Plot_Axes.png|32px]] [[Plot_Axes|Axes]]: Add, remove or edit plot axes.
+
== Introduction ==
* [[Image:Plot_Series.png|32px]] [[Plot_Series|Series]]: Edit series title and styling.
+
 
* [[Image:Plot_Grid.png|32px]] [[Plot_Grid|Grid]]: Show/hide grid.
+
FreeCAD is able to perform plots using the [https://matplotlib.org/ matplotlib] [[Python|Python]] library. A module is provided to this end, as an external add-on in version 0.19 and as a core component from version 0.20 on. Older versions of FreeCAD are not covered in this documentation.
* [[Image:Plot_Legend.png|32px]] [[Plot_Legend|Legend]]: Show/hide legend.
+
 
* [[Image:Plot_Labels.png|32px]] [[Plot_Labels|Labels]]: Edit labels.
+
The produced plots offer the standard [https://matplotlib.org/ matplotlib] tools to edit and save. On top of that, a [[Image:Workbench_Plot.svg|24px]] [[Plot_Workbench|Plot Workbench]] is provided as an external add-on offering more complete tools to edit the plot and save it. The add-on can be installed with the [[Std_AddonMgr|Add-on manager]].
* [[Image:Plot_Positions.png|32px]] [[Plot_Positions|Positions]]: Set elements positions.
+
 
 +
==Module==
 +
 
 +
The module can be invoked in a Python console or in a [[Macros|macro]]. The first thing you must do is importing the module. In FreeCAD 0.19 you must first install the [[Image:Workbench_Plot.svg|24px]] [[Plot_Workbench|Plot Workbench]] using the [[Std_AddonMgr|Add-on manager]], and then you can import Plot by typing:
 +
 
 +
{{Code|code=
 +
from freecad.plot import Plot
 +
}}
 +
 
 +
Since FreeCAD 0.20 the plot module is already packaged with the program, so you don't need to install any add-on, but just type:
 +
 
 +
{{Code|code=
 +
from FreeCAD.Plot import Plot
 +
}}
 +
 
 +
After that, you can plot a straight line from (0,0) to (1,2) just simply typing:
 +
 
 +
{{Code|code=
 +
Plot.plot([0, 1], [0, 2])
 +
}}
 +
 
 +
You can find more complex examples in the [[Plot_Basic_tutorial|Plot Basic tutorial]] and the [[Plot_MultiAxes_tutorial|Plot MultiAxes tutorial]].
 +
 
 +
==Workbench Tools==
 +
 
 +
If you decide to install the [[Image:Workbench_Plot.svg|24px]] [[Plot_Workbench|Plot Workbench]] using the [[Std_AddonMgr|Add-on manager]], you will have the following tools available to manage the plots created with the module:
 +
 
 +
* [[Image:Plot_Save.svg|32px]] [[Plot_Save|Save plot]]: Saves the plot in several formats. You can select the output size and resolution too.
 +
* [[Image:Plot_Axes.svg|32px]] [[Plot_Axes|Axes]]: Add, remove or edit plot axes.
 +
* [[Image:Plot_Series.svg|32px]] [[Plot_Series|Series]]: Edit series title and styling.
 +
* [[Image:Plot_Grid.svg|32px]] [[Plot_Grid|Grid]]: Show/hide grid.
 +
* [[Image:Plot_Legend.svg|32px]] [[Plot_Legend|Legend]]: Show/hide legend.
 +
* [[Image:Plot_Labels.svg|32px]] [[Plot_Labels|Labels]]: Edit labels.
 +
* [[Image:Plot_Positions.svg|32px]] [[Plot_Positions|Positions]]: Set elements positions.
  
 
==Scripting==
 
==Scripting==
Since Plot module is a layer over matplotlib, you are free to use all matplotlib commands over plot instances. See [[Scripting_examples|scripting examples]] section to see examples.
+
 
 +
Since the Plot Workbench is a layer on top of {{incode|matplotlib}}, you are free to use any function from this library on plot instances. See [[Scripting_and_macros|Scripting and macros]] for examples.
  
 
==Tutorial==
 
==Tutorial==
* [[Plot Basic tutorial]]
 
* [[Plot MultiAxes tutorial]]
 
  
{{Docnav| | }}
+
* [[Plot_Basic_tutorial|Plot Basic tutorial]]
 +
* [[Plot_MultiAxes_tutorial|Plot MultiAxes tutorial]]
  
[[Category:User Documentation]]
 
  
{{clear}}
+
{{Plot_Tools_navi{{#translation:}}}}
<languages/>
+
{{Userdocnavi{{#translation:}}}}
 +
[[Category:External_Workbenches{{#translation:}}]]
 +
[[Category:Addons{{#translation:}}]]

Latest revision as of 16:48, 25 June 2022

Other languages:
Bahasa Indonesia • ‎Deutsch • ‎English • ‎Türkçe • ‎español • ‎français • ‎hrvatski • ‎italiano • ‎magyar • ‎polski • ‎português • ‎português do Brasil • ‎română • ‎svenska • ‎čeština • ‎български • ‎русский • ‎中文 • ‎中文(中国大陆)‎ • ‎中文(台灣)‎
Plot workbench icon

Introduction

FreeCAD is able to perform plots using the matplotlib Python library. A module is provided to this end, as an external add-on in version 0.19 and as a core component from version 0.20 on. Older versions of FreeCAD are not covered in this documentation.

The produced plots offer the standard matplotlib tools to edit and save. On top of that, a Workbench Plot.svg Plot Workbench is provided as an external add-on offering more complete tools to edit the plot and save it. The add-on can be installed with the Add-on manager.

Module

The module can be invoked in a Python console or in a macro. The first thing you must do is importing the module. In FreeCAD 0.19 you must first install the Workbench Plot.svg Plot Workbench using the Add-on manager, and then you can import Plot by typing:

from freecad.plot import Plot

Since FreeCAD 0.20 the plot module is already packaged with the program, so you don't need to install any add-on, but just type:

from FreeCAD.Plot import Plot

After that, you can plot a straight line from (0,0) to (1,2) just simply typing:

Plot.plot([0, 1], [0, 2])

You can find more complex examples in the Plot Basic tutorial and the Plot MultiAxes tutorial.

Workbench Tools

If you decide to install the Workbench Plot.svg Plot Workbench using the Add-on manager, you will have the following tools available to manage the plots created with the module:

  • Plot Save.svg Save plot: Saves the plot in several formats. You can select the output size and resolution too.
  • Plot Axes.svg Axes: Add, remove or edit plot axes.
  • Plot Series.svg Series: Edit series title and styling.
  • Plot Grid.svg Grid: Show/hide grid.
  • Plot Legend.svg Legend: Show/hide legend.
  • Plot Labels.svg Labels: Edit labels.
  • Plot Positions.svg Positions: Set elements positions.

Scripting

Since the Plot Workbench is a layer on top of matplotlib, you are free to use any function from this library on plot instances. See Scripting and macros for examples.

Tutorial