Aptech Systems, Inc. Worldwide Headquarters
Mailing Address:
PO Box 250
Black Diamond, WA 98010 USAStreet Address:
30741 Third Avenue #160
Black Diamond, WA 98010 USAPhone: 360.886.7100
FAX: 360.886.8922Ready to Get Started?
For Pricing and Distribution
Industry Solutions
Products
Resources
Support
Training & Events
Want more guidance while learning about the full functionality of GAUSS and its capabilities? Get in touch for in-person training or browse additional references below.
Tutorials
Step-by-step, informative lessons for those who want to dive into GAUSS and achieve their goals, fast.
Have a Specific Question?
Get a real answer from a real person
- Need Support?
Q&A: Register and Login
Support Plans
Premier Support and Platinum Premier Support are annually renewable membership programs that provide you with important benefits including technical support, product maintenance, and substantial cost-saving features for your GAUSS System or the GAUSS Engine.
User Forums
Join our community to see why our users are considered some of the most active and helpful in the industry!
Where to Buy
Available across the globe, you can have access to GAUSS no matter where you are.
Recent Tags
applications character vectors CMLMT covariance matrix dates dlibrary dllcall ECDF Editor error handling errors floating network GAUSS Engine Geometric mean graphics GUI hardware histogram hotkeys if statements installation Java API linux localization Matlab convert matlab translation matrices matrix initialization matrix manipulation Maxlik MaxLikMT Memory output pgraph graph PQG graphics RAM random numbers RedHat 6.1 simulation string functions strings threading threads loops Time Series writing dataRecent Questions
Features
Resources
Axis control with PlotXY()
While I like the new GAUSS graphics, I’m having trouble controling the plot axes.
For example, I’m plotting some economic data from the 1960s to the present, so my x-vector for plotxy() is just something like seqa(1966,0.25,rows(Y)).
When my Y data is strictly positive, that works fine.
However, when my Y data contain both positive and negative values, plotxy insists on starting the x-axis at year 0, which scrunches all my data into a blur at the extreme right of the graph.
Surely there’s a simple way to avoid this…..but I can’t find it.
Any suggestions?
3 Answers
I tried this program below and a few combinations (more curves, only one negative element, without using a plotcontrol struct) on Windows 7 and Linux with GAUSS 13.0.3. In all cases the x axis ranged from the minimum x value to the maximum x value.
struct plotControl myPlot;
myPlot = plotGetDefaults("xy");
x = seqa(1960, 0.25, 53*4);
y = cos(seqa(0.1, 0.1, rows(x)));
plotxy(myPlot, x,y);
Does this display correctly for you? Could you save your x and y variables as .fmt files with the save command and send them to support.
Hi Jason.
Thanks for your answer. Your example displays perfectly for me.
I’ve tried to create a single example that reproduces the problem, using my original data saved in .fmt format as you suggested. (I can’t figure out how to attach the .fmt file to this forum post, so I’ll send that separately by e-mail.) Here’s a program that should reproduce the problem.
new;
struct plotControl myPlot;
myplot = plotGetDefaults("xy");
load rawdataF;
PlotSetLegend(&myplot,"off");
plotxy(myplot,seqa(2009-0.25*cols(rawdataF),.25,cols(rawdataF)),rawdataF');
This gives me a plot whose horizontal axis starts at 0, despite the fact that rawdataF is a 157×170 matrix.
Thanks in advance for your help.
Simon
This is a problem related to all of the columns being passed into plotXY that have only missing values. This has already been fixed in version 13.1 which will be released in January 2013.
As a workaround here is a procedure to remove all rows that only contain missing values.
new; struct plotControl myPlot; myplot = plotGetDefaults("xy"); load rawdataF; PlotSetLegend(&myplot,"off"); x = seqa(2009-0.25*cols(rawdataF),.25,cols(rawdataF)); plotXY(myPlot, x, delMissRows(rawdataF)'); proc delMissRows(x); local mask, idx, xout, rtrim, xctr; //Which rows have as many missings as columns mask = sumr(x .== miss(0,0)); //Preallocate output matrix rtrim = sumc(mask .== cols(x)); xout = zeros(rows(x) - rtrim, cols(x)); //Fill in xout xctr = 1; for i(1, rows(x), 1); if mask[i] != cols(x); xout[xctr, .] = x[i,.]; xctr = xctr + 1; endif; endfor; retp(xout); endp;
Thanks! That fixes the problem.
Here’s a slightly simpler version of delMissRows() that works just as well:
proc delMissRows(x); local mask; mask = sumr(x .== miss(0,0)); // number of missing entries per row mask = mask .< cols(x); // 1 if a row has some non-missing entries retp(selif(x,mask)); // returns only those rows where mask .== 1 endp;

