Plot MultiAxes tutorial/pl

Upewnij się, że odwiedziłeś Poradnik: Podstawy dla środowiska pracy Wykres przed rozpoczęciem tego poradnika. W tym poradniku nauczymy się jak tworzyć i edytować wykres wieloosiowy. Na stronie Wykres możesz dowiedzieć się więcej o tym środowisku pracy.

Przykład wykresu wieloosiowego.

In previous image you can see the result that we aproximately will obtain. Following this tutorial you will learn:
 * How to create a multiaxes Plot from Python Console.
 * How to edit axes properties.
 * How to control grid/legend when several axes is present.
 * How to edit labels, titles and legend positions.

Plotting data
As we did in previous tutorial we will use the Python console or macros in order to plot the data, with the difference that in this case we will plot the data in two different axes.

Creating plot data
In this example we will plot 3 functions, the two ones used in previous tutorial, and another polynomial one. The fact is that the polynomial one will need new axes due to the variation range is different from all others. Next commands will create data arrays for us:

As x moves from 0 to 2, y function has a maximum value of 4, so if we try to plot this function with trigonometrical ones, at least one function will be truncated or bad scaled, then we need a multiaxes plot. Multiaxes plot in FreeCAD is oriented to get a plot with multiple axes, not to get multiple plots in same document.

Drawing functions, adding new axes
We will draw polynomial function at main axes. If all your axes will have same size then is not relevant what function is ploted in what axes, but if your plot has axes with other size (as in this example), main axes must be the biggest one (because this axes have the white background). In order to do it we only need to launch a command

In this example we pass directly the series label for the legend. Note that the label string has the r prefix in order to avoid Python try to interpret special characters (\ symbol is used frecuently in LaTeX syntax).

Now we can plot trigonometrical functions, creating new axes before. In FreeCAD Plot module when you create new axes this axes are selected as active ones, so new plots will be associated to this axes.

As you can see you plot has gone crazy, with axes ticks overlaped, curves of same color, etc. Now we needs to use FreeCAD Plot module to fix this graph.

Konfigurowanie osi
Moduł Wykres FreeCAD dostarcza narzędzia do modyfikacji właściwości każdej z osi.

Ikonka narzędzia konfiguracji osi.

Pierwszą rzeczą, którą można znaleźć w narzędziu osi jest selektor aktywnych osi. Ponieważ osie aktywne są ostatnimi, aktywne osie są umieszczone na pierwszej pozycji. Narzędzie Osie, podobnie jak narzędzie Etykiety, pozwala ustawić aktywne osie, umożliwiając wykreślanie większej ilości danych na osiach, których potrzebujemy (w tym dodawanie / usuwanie osi). Na razie będziemy pracować nad wybranymi osiami, które są związane z funkcjami trygonometrycznymi.

W suwakach wymiarów przesuniemy suwaki lewy poziomy i dolny pionowy (starając się naśladować przykład), aby zmniejszyć rozmiar osi. Następnie możemy ustawić wyrównanie osi, zmieniając je na górne i prawe, oraz ustawiając niewielkie przesunięcie o dwie jednostki.

Konfiguracja serii
Ustaw właściwości serii tak jak to robiliśmy w poprzednim poradniku.

Showing grid and legend
Grid and legend is shown and hide with the same tools that used in previous tutorial, but in this case the behaviour is a little bit different due to the presence of two different axes.

Regarding grid lines, you can show lines for each axes set, for example, if you try to show grid now you will show only the grid of the trigonometrical functions, so in order to show the grid of polynomial function plot you needs to change active axes to 0 (using axes configuration tool) before using grid tool another time (Is possible that you need to press two times the tool).

Regarding legend, the legend will be the same for both axes, so you can choose the axes that you want in order to show the legend, but is strongly recommended to use the biggest ones (0 in this example) because position will be refered to this axes coordinates. If you show the legend you can see that is really bad placed, we will fix this problem later.

Setting axes labels
You can set axes labels with same tool used in previous tutorial, with the difference that now you have more axes. Since axes labels is ussually set as one per axis, is not a significant difference, but FreeCAD Plot module allow you to set a title by axes too. In this case we only wants to set title to main axes, so set:

Axes 0: Axes 1:
 * Title = Multiaxes example
 * X Label = $x$
 * Y Label = $\mathrm{f} \left( x \right)$
 * X Label = $t$
 * Y Label = $\mathrm{f} \left( t \right)$

Set also 20 to fontsize for all but title, that uses a fontsize of 24. As happens with legend, title is bad placed, interseting with second axes set, so we need to solve both problems.

Setting elements position
FreeCAD Plot module provides a tool in order to set the position of several plot elements, as titles, labels or legend.

Position editor icon.

When you run the tool you see a list with all the editable elements. Title elements, as well as legend, can be moved in both directions, since axes labels can be moved only on the axes direction. Select title of axes 0 and move it to (0.24,1.01), then select legend and move it to a better position. You can increase legend labels fontsize too.

Zapisanie wykresu
Teraz możesz zapisać swoją pracę. Zobacz poprzedni poradnik jeśli nie pamiętasz jak to zrobić.