Dear all,
I couldn't find advice on whether to split up my two questions in 2 posts or put them into one.
I am using Stata 15.0
Here is an dataex example output:
So my first problem is that when I coefplot the variable BA3 the one bar only uses up a small part of the plot region (I hope I am using proper vocabulary here), so there is lots of white space on the top and bottom. How can I resize the graph adjusting to that bar? I do want to keep using this command however since I have several catplot commands that generate 5 bars or more - which uses up the space in a satisfying way - and the graphs should look uniform since they are made for a report.
My catplot code is:
My second problem is with special letters like 'ä', 'ß' in labels of a graph produced by catplot (see code below). When I tabulate BA8a_alle it stata displays them properly. When I run the following Code No.1 it displays them properly. However, when I run following Code No.2 (just added graph play and graph export command) it displays them as questionarks in both the output graph window and the saved .png-file.
Code No.1
Code No.2
I hope I did no mistakes creating this post (2 issues in one and this [CODE] stuff). Thanks for your help in advance!
Best regards
Adam Reiner
I couldn't find advice on whether to split up my two questions in 2 posts or put them into one.
I am using Stata 15.0
Here is an dataex example output:
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input double(BA3 sex BA8a_alle) 2 1 10 2 2 1 1 2 12 2 2 2 2 1 2 2 1 12 1 1 7 2 1 5 2 2 4 1 2 12 2 1 3 2 2 .a 2 1 5 2 1 3 2 1 7 2 1 11 3 1 .d 4 2 11 1 2 4 4 2 .d end label values BA3 BA3 label def BA3 1 "sehr unwahrscheinlich", modify label def BA3 2 "eher unwahrscheinlich", modify label def BA3 3 "ungefähr 50 zu 50", modify label def BA3 4 "eher wahrscheinlich", modify label values sex sex label def sex 1 "männlich", modify label def sex 2 "weiblich", modify label values BA8a_alle BA8a_alle label def BA8a_alle 1 "Philosophie/Geschichts-/Kulturwissenschaft", modify label def BA8a_alle 2 "Sprachwissenschaft", modify label def BA8a_alle 3 "Politik-/Verwaltungs-/Sozialwissenschaft", modify label def BA8a_alle 4 "Rechtswissenschaft", modify label def BA8a_alle 5 "Wirtschaftswissenschaft (BWL/VWL)", modify label def BA8a_alle 7 "Erziehung/Pädagogik (nicht Lehramt)", modify label def BA8a_alle 10 "Chemie/Biologie/Ernährung", modify label def BA8a_alle 11 "Ingenieurswissenschaft/Informatik", modify label def BA8a_alle 12 "eine andere als die oben gelisteten", modify
So my first problem is that when I coefplot the variable BA3 the one bar only uses up a small part of the plot region (I hope I am using proper vocabulary here), so there is lots of white space on the top and bottom. How can I resize the graph adjusting to that bar? I do want to keep using this command however since I have several catplot commands that generate 5 bars or more - which uses up the space in a satisfying way - and the graphs should look uniform since they are made for a report.
My catplot code is:
Code:
catplot BA3, l1title("") percent asyvar stack blabel(bar, color(black) format(%9.2g) pos(center)) title("Bestehen der Abiturprüfung") ytitle ("Prozent") note("Die Frage lautete im Wortlaut:" "Schätzen Sie ein: Wie wahrscheinlich ist es, dass Sie die Abiturprüfung bestehen werden?",size(3) margin(medlarge)) bar(1, fcolor("37 104 131")) bar(2, fcolor("97 152 48")) bar(3, fcolor("227 1 126")) bar(4, fcolor("106 184 213")) bar(5, fcolor("157 209 109"))
Code No.1
Code:
catplot sex BA8a_alle, percent(sex) asyvars ytitle("Percent") legend(label(1 "man") label(2 "women")) title("Idealistische Studienfachwahl") subtitle("") ysize(10) blabel(bar, format(%9.1f)) xsize(15)
Code:
catplot sex BA8a_alle, percent(sex) asyvars ytitle("Percent") legend(label(1 "man") label(2 "women")) title("Idealistische Studienfachwahl") subtitle("") ysize(10) blabel(bar, format(%9.1f)) xsize(15) graph play catplotrelabelstud graph export graph11.png, replace
Best regards
Adam Reiner
Comment