Matplotlib scatter marker style11/10/2023 ![]() The linestyle is specified by a tuple of the form: A six-digit hex code (such as "#ff8000") specifies the RGB components as hex values, for example 0xff red, 0x80 green, 0x00 blue.There are 140 named colours, you can find a list of them online. A name (such as "cadetblue") specifies one of the CSS named colours.A single letter (such as "b" for blue) specifies one of the 8 colours in the previous list.Colour specifiersĬolours are defined by a string value, but there are various ways to do this. Since the default resolution for a graph image created by Matplotlib is 100 pixels per inch this means that the linewidth parameter of a plot is approximately equal to the line width in pixels. The line width is measured in points, where one point is one seventy-second of an inch (ie there are 72 points in an inch). You can also use the lw parameter - it does exactly the same thing, but it is a shorter name. The line width of a Matplotlib plot is controlled by the linewidth parameter. dash_capstyle="round" - this causes each dash to have rounded ends (rather than the default square ends).linestyle=(0, (4, 2, 1, 2)) sets the dash pattern, see below. ![]() linewidth=6 sets the line thickness to 6 pixels.color="#ff8000" sets the colour to hex value ff8000 (orange), see below.linewidth=4 sets the line thickness to 4 pixels.įor the second plot, we supply these parameters:.color="cadetblue" sets the colour to a CSS named colour (in this case a blue-green colour).The data is created in the same way as before, so we haven't duplicated the code.įor the first plot, we supply these parameters: plot ( x, y1, color = "cadetblue", linewidth = 4 ) plt. Named parameters give us more options for each aspect of the appearance: There is no marker.Īs an alternative, we can set the colour and line style for a graph using named parameters of the plot function. "-.r" represents the line style dash-dot ("-.") and the colour red ("r").The part specifies the colour of the line and/or markers: _ (underline character) horizontal line. ![]()
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |