Multiple images in scilab simultaneously - scilab

How do we display more than one image simultaneously in scilab? I used to do it using figure,imshow() in matlab. Whats the scilab alternative?
Thank you.

Multiple imshow windows
Assuming you are using SIVP for image processing in SciLab, it is currently only possible to show one imshow window at a time.
Quote from the SIVP imshow documentation :
Bugs and Shortcomings
Only one imshow window can pop up.
Workaround
A workaround is to combine multiple images and show that image, for example:
// Two example images
im1 = ones(400,600);
im2 = rand(400,600);
// Put images side by side
im3 = [im1 im2];
imshow(im3);
// or put them top-to-bottom
im3 = [im1 ; im2 ];
imshow(im3);
When combining images be sure to have matching dimensions, so when placing images side-by-side the number of rows must match and when placing them top-to-bottom the number of columns must match.

Related

Adjust Rmarkdown's inline chunk output - increase no. of columns displayed?

This is a workflow related question. I'm trying out working only (or mostly) in the Rmarkdown source window with the options set to "Chunk output inline". So with R open, there is just one big window -The environment, Console and File windows being minimized.
My question: Is there some option to change the number of columns displayed? I want to increase the numbers of columns visible without scrolling (see screenshot below), and since there is enough space I think it should be possible to display more of them.
Many thanks!
Solution: There is an option. Just add cols.print = 12 (or whatever number you want) to global options.
Also, people might find this 'manual' on markdown useful: https://bookdown.org/yihui/rmarkdown/html-document.html#paged-printing

rectangles on Grace plots

I have been using Grace (xmgrace) plotting for many years. I recently had an important idea for my work, and it involves rectangles on my plots. Grace supports rectangles (called "boxes"), but when I use a filled "box" it blocks my data curves. I want the curves to show over the filled rectangles. This is driving me nuts. Does anyone know how to put the filled rectangles in the background so they don't block data curves? Thanks.
Unfortunately there is no option in the xmgrace graphical interface that allows you to modify the z order of drawing objects such as boxes:
I also saved the graph as an .agr file and viewed it in a text editor. There doesn't seem to be any flag within the file format to modify z position, either.
Same story if you save a parameter file and check it in a text editor.
So it looks like it is really not possible in xmgrace.
One workaround would be to print to a postscript, EPS or SVG file and open it inside a vector graphics program such as Inkscape (results vary, you might need to experiment with filetypes to see which works best). Then you can easily alter the z order of objects.

How to use JuliaImages to create a smaller image given a starting image?

I just got done exploring the docs for JuliaImages found here. What I want to do is as follows:
I have an image. It is a map of sorts. It takes up a lot of space so I want to index into the image and create a new smaller image that is just essencially a zoomed-in version of the original image. I know I could do this manually, but I want to create a re-usable script that I can use to apply this operation to N number of images. How can I do this using JuliaImages?
If by "zoomed in" you mean focusing on a small portion of the image and making it look bigger, you can do this with ordinary array-indexing tools. For example, img[251:500,147:328] would extract a portion of the image.
If what you're really looking for is a thumbnail, my favorite approach is to use restrict. That is limited to 2-fold reductions. You can also imfilter (best with the IIRGaussian filters of ImageFiltering.KernelFactors) and then call imresize. But there will be no beating the performance of restrict.

Image returns w/ different nominalScale() after applying reducer.mean()

I am working on a simple script to get mean value from a ImageCollection(). To do this I am using ImageCollection.reduce(ee.Reducer.mean()).
My problem is that the Image returned is coming with a different nominalScale().
I already looked at the documentation but couldn't figure out why this results. As you can see on ee.ImageCollection.reducer() there is no parameter specifying the scale; nor on ee.Reducer.mean().
What am I doing wrong?
Again, I am basically trying to do do something like this. Actually this tutorial shows an image which made me believe I wouldn't have changes on pixel resolution...
My code:
var WorldClim = ee.ImageCollection("WORLDCLIM/V1/MONTHLY");
print("WorldClim original", WorldClim.first().projection().nominalScale());
var WorldClim = WorldClim.select("prec");
print("Apenas prec:", WorldClim.first().projection().nominalScale());
var MeanPrec = WorldClim.reduce(ee.Reducer.mean());
print("Após reduce(ee.Reducer.mean())", MeanPrec.projection().nominalScale());
https://code.earthengine.google.com/3e3bff9030fd9ff70b052b2beb4daced
That is most likely due to the image pyramiding of image. Since the mean image is a temporary object only in memory buffer, it should not have a base nominal scale and since the tiles are computed based on whatever zoom level your map is currently at.
However, there is a way you can fix this if you specifically want to work with the resolution of the source image. You basically have to reproject the image to the same one the original has. One way to do this would be to change the line where you compute mean to
var MeanPrec = WorldClim.reduce(ee.Reducer.mean()).reproject({
crs:WorldClim.first().projection(),
scale:WorldClim.first().projection().nominalScale()
});

How to get figure(n)?

In matplotlib or matlab you can do something like:
figure(n)
clf()
How do we do this in R?
The desired action is to bring up a new blank plotting window in window "n" i.e. n=3. All subsequent plotting commands will appear in this active window.
I've definitely figured this out before but I always have to look it up when I come back to R.
I think "x11" plus some option might be the trick.
If you have multiple graphics devices open then dev.list will show a list of the open devices. The dev.cur function returns which of those is the current/active device. You can use dev.set to choose which of the open devices to make the current or active device (where new plots will go to). You could also use dev.next and dev.prev along with dev.set to cycle through the active devices. You can look at the names of the return values from these functions to see what kinds of devices they are, this may help to rotate through screen devices while skipping file devices.
If you are in a mulptiple figure setup (par(mfrow=c(3,2))) within a single device, then you can use par(mfg=c(r,c)) to set the figure in the r'th row and c'th column as the next figure to be plotted into.

Resources