Aptech Systems, Inc. Worldwide Headquarters
Aptech Systems, Inc.
2350 East Germann Road, Suite #21
Chandler, AZ 85286
Ready to Get Started?
Request Quote & Product Information
Training & Events
Step-by-step, informative lessons for those who want to dive into GAUSS and achieve their goals, fast.
Have a Specific Question?
Q&A: Register and Login
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.
Join our community to see why our users are considered some of the most active and helpful in the industry!
Where to Buy
Recent Tagsapplications character vectors CML CMLMT Constrained Optimization datasets dates dlibrary dllcall error error handling errors Excel FANPACMT file i/o floating network GAUSS Engine graphics GUI hotkeys installation Java API license licensing linux loading data matrices matrix matrix manipulation Maxlik MaxLikMT Memory optimization Optmum output PQG graphics procs RAM random numbers string functions strings structures threading Time Series writing data
Time Series 2.0 MT
Find out more now
Time Series MT 2.1
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.
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.
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 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 157x170 matrix.
Thanks in advance for your help.
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;