It's also possible to change the axes and gridlines on the tidies up scatter plot: twoway scatter price mpg, /// Mlab(make) mlabsize(small) mlabpos(12) /// Mlcolor(red%40) mfcolor(midblue%40) symbol(triangle)/// It doesn't look good on this graph, but it is possible to add labels tp the markers: twoway scatter price mpg, /// Mlcolor(red%40) mfcolor(midblue%40) symbol(triangle) /// For example, the dots ( markers in Stata speak)Ĭan have different coloured outline and fills, and the shape can be changed: Going back to the simple scatter graph tha we modified slightly: twoway scatter price mpg, /// With all options for all graphs, but you need to follow a link-trail to figure Title("Price and miles per gallon", margin(b=5) pos(11) color(black))Ī good way to figure out what each option does it just to cpy and past this codeĪnd re-run it taking them out on-by-one. Graphregion(fcolor(white) lcolor(white)) /// With a few basic options he basic scatter plot can be tidied up a lot: twoway scatter price mpg, /// One way to change this is just to use one of Stata’s in-built schemes: twoway scatter price mpg, ///īut it’s good to get to grips with the gaph syntax to make your own,Īnd present them exactly how you’d like them - or in line with company/organisation branding. The axes labels: twoway scatter price mpg, /// To play around with some formatting, just add a comma at theĮnd of the command and start playing around with the options. On cars, and produce a basic graph - how are price and miles per gallon correlated? sysuse "auto.dta"
#Twoway scatter stata update#
I'll update this from time-to-time based on questions and things that come up. do file and include/exclude options one at a time to see how they change the charts.
#Twoway scatter stata code#
Probably the best thing to do is to copy and paste any code that looks interesting into a. It's meant to show the flexibility of Stata graphs, and provide some example code to play around with. to some basic graphs in Stata that I use for introductory courses. Using Stata also means you can have pre-made code with your preferred options that you can justĬopy and paste/re-use for similar settings. In Excel and then make a graph by hand, this isn't straightforward. Results most effectively, this should also be the case for graphs. Since they are often main motivation for a research question, or present it's good practice to make sure your work If you're writing a paper, essay, article etc. On Stata graphs aren't very nice and Excel let's you do it all by hand. This is probably because the default colour, look, scales etc. Stata has great graphing, but most people don't think so after the first few uses and revert toĮxcel (or say how much better it is).