Xline stata color4/21/2024 ![]() ![]() ![]() I want to plot on the same graph both types of inflation for a number of countries. My question is, given the limit on number of arguments, is there a way to assign one color to lines of Set1 and another color to lines of Set2.įor illustration, the Set1* lines are headline inflation, and Set2* lines are underlying inflation. Xsize(10) ysize(20) xlabel(#10) ylabel(1(4)14, labsize() tlength(zero) glwidth(vvvthin) glstyle(dot) glcolor(black)) ytick(none) ymlabel(none) Subtitle(,size(small)) tlabel(,format(%tCHH) labsize(vsmall)) legend(off) ytitle("") xtitle("") title("") /// Lcolor (red red red red red red red red red red red red red red blue blue blue blue blue blue ) /// Graph twoway tsline Set1A Set1B Set1C Set1* Set2A Set2B Set2C Set2*, /// You might look into "pstyles".Thanks Doug. It gives you a histogram of price under two different categories: Foreign and Domestic.It would help to have the code you are starting from, to better understand the organization of the data you are starting from, and the graph you hope to end up with. Similarly, we can use the mcolor() option in a twoway histogram: twoway (histogram price if foreign, width(500) start(2000) color(red%50) disc freq) (histogram price if !foreign, width(500) start(2000) color(blue%50) disc freq), legend(order(1 "Foreign" 2 "Domestic")) This will give you a graph with 20% opacity in red: If you want the marker colors to be red and with 20% opacity, you will need to specify mcolor(red%20): histogram price, color(red%20) frequency NOTE: Normally we use the marker color option mcolor(), we use color() option here because that is where colors are specified for histograms. If you want to change the color, you will need to specify the color you want, if you omit the color specification, Stata will adjust only the opacity of the object. In the above command, color(%20) means that markers are to be the default color with 20% opacity. For example: histogram price, color(%20) frequency Then right click, select Plot region properties, then a window will pop up, you can change your graph’s color and opacity manually:Īlternatively, we can type directly in the command pane. To adjust the transparency, in the Graph window, click the Graph Editor button to Start Graph Editor: 100% means that the color fully hides the background, and 0% means that the color has no coverage ans is fully transparent. opacity is the percentage of a color that covers the background color. Stata will produce a basic histogram, with default color and 100% opacity. In the command pane (you can also use the menu to achieve the same result: Graphics > Histogram), I type: histogram price, frequency To demonstrate, I use the automobile dataset.įirst, let’s start from the simple histogram. As a new feature in Stata 15, it allows you to specify the percentage opacity. ![]() However, sometimes you might want to see what lies underneath, and that usually produces better-looking graphs. ![]() By default, the elements in Stata graph is not transparent, or 100% opaque. In this post, I’m going to show you how to adjust the transparency of your Stata graph. ![]()
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |