Reputation: 3
I'm sorry if this question has been asked before, I couldn't find it anywhere.
I just want to "move" the x axis from the bottom of the graph to the top. So "10" on the x axis should be next to "10" on the y axis (I hope this makes sense).
Here's my code:
twoway scatter h a, xscale(log) yscale(log) ///
xscale(r(10 100000)) ///
yscale(r(0.0000001 0.1)) ///
xlabel(10 100 1000 "1'000" 10000 "10'000" 100000 "100'000", grid labsize(small)) ///
ylabel(1 "10" 0.1 "100" 0.01 "1'000" 0.001 "10'000" 0.0001 "100'000" 0.00001 "1 Mio." 0.000001 "10 Mio." 0.0000001 "100 Mio.", angle(0) labsize(small)) ///
xtitle("{bf:Gesamtschaden}" "Mio. CHF", ///
size(small)) ///
ytitle("{bf:Häufigkeit}" "1 x in ... Jahren", ///
size(small)) ///
Many thanks in advance!
Upvotes: 0
Views: 827
Reputation: 24722
You can use axis suboption alt
to alternate the default location of an axis (i.e. if default is bottom, alt
will move it to the top)
twoway scatter h a, xscale(log alt) yscale(log) ///
xscale(r(10 100000)) ///
yscale(r(0.0000001 0.1)) ///
xlabel(10 100 1000 "1'000" 10000 "10'000" 100000 "100'000", grid labsize(small)) ///
ylabel(1 "10" 0.1 "100" 0.01 "1'000" 0.001 "10'000" 0.0001 "100'000" 0.00001 "1 Mio." 0.000001 "10 Mio." 0.0000001 "100 Mio.", angle(0) labsize(small)) ///
xtitle("{bf:Gesamtschaden}" "Mio. CHF", ///
size(small)) ///
ytitle("{bf:Häufigkeit}" "1 x in ... Jahren", ///
size(small)) ///
Upvotes: 1
Reputation: 37208
I agree with @langtang. Here is a reproducible example, with some tweaks to make it slightly interesting.
webuse grunfeld, clear
scatter invest mvalue, ysc(log) xsc(log alt) yla(5000 1000 500 100 50 10 5 1, ang(h)) xla(5000 2000 1000 500 200 100 50) ms(none) mla(company) mlabpos(0)
Upvotes: 1