![]() ![]() Also if I do: print label.gettext () nothing is printed. ![]() In order to change the axis labels we use the txlabel () and tylabel () methods as in the following example. However, if try: ttext ('Foo') the tick label is not modified. A simple line plot example using Matplotlib Changing the axis labels We can change the labels and the axis values themselves. If you are stuck on an older version of matplotlib, you can still achieve the result by overlaying a scatterplot on the line plot. label () 2.label tfontsize (size) trotation ('vertical') the font size and the orientation of the tick label is changed. This last example using the markevery kwarg is possible in since 1.4+, due to the merge of this feature branch. Plt.plot(xs, ys, '-gD', markevery=markers_on, label='line with select markers') Here is a list of the possible line and marker styles: =Įdit: with an example of marking an arbitrary subset of points, as requested in the comments: import numpy as np In the example below, the following text properties are provided to the function in order to customize the label text: fontweight, color, fontsize, and horizontalalignment. You need to pass a string for the label text to the function. ![]() Specify the keyword args linestyle and/or marker in your call to plot.įor example, using a dashed line and blue circle markers: plt.plot(range(10), linestyle='-', marker='o', color='b', label='line with marker')Ī shortcut call for the same thing: plt.plot(range(10), '-bo', label='line with marker') You can customize the title of your matplotlib chart with the xlabel () and ylabel () functions. ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |