octave plot over image: image disappears when scrolling or zooming (gnuplot) - gnuplot

I can successfully plot over an image but then as soon as I scroll or zoom, the image disappears (the plot stays displayed).
I have tried plotting images by using the exact code here. I Also tried using by using imread/imshow,or imagesc instead of imshow, the behavior remains the same (image disapearing).
Not sure whether this is related or not but when using imread I get the following warning "|warning: your version of GraphicsMagick limits images to 8 bits per pixel"
I am using octave 3.8.2 and gnuplot (5.0 patchlevel 1) on os X 10.11.1
Any suggestion on how to keep image displayed while scrolling or zooming?

Related

Is it possible to update inline plots in Python (Spyder)?

Setup: Anaconda 3 (Win10 64), Spyder 4 and Python 3.7. The IPython Graphics setting is default (Inline).I'm still a new to Python but I've looked around and have not found an answer that solves my problem so far. Thanks everyone in advance.
So in this setup, whenever I create a plot using matplotlib, it appears in the plot pane of Spyder. e.g.
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
df = pd.DataFrame(np.random.randint(0,100,size=(100, 1)), columns=list('A'))
bp = df.boxplot(column = 'A')
creates a boxplot. Now, if I want to add a title to the plot, the code would be
bp.set_title("This Title")
This is where I'm getting some problems. If I run the entire block together
df = pd.DataFrame(np.random.randint(0,100,size=(100, 1)), columns=list('A'))
bp = df.boxplot(column = 'A')
bp.set_title("This Title")
then I get a box plot with "This Title" as the title, showing up in the plot pane,
which is what I want.
However, if I run the above code line by line in the IPython console, the 2nd line will produce a boxplot as expected, but the 3rd line will not have an effect on the image in the plot pane, so the image in the plot pane still do not have a title
Now,if i go to Tools > Preference >IPython Console > Graphics and set the graphics backend to Automatic instead of the default Inline, then when I run the code in the Console line by line, I get an image that pops up in another window, and that it does update/refreshes based on new lines entered into the console. I understand that the inline plots are supposed to be static, but I thought I saw another post where someone said that it is possible to update inline plots? So now my questions are:
Do plots only update/refresh by line codes in the IPython console if the Graphics Backend is not static like inline?
Why do I get different result when I run code blocks vs line by line?
If it is possible to update the inline plots (preferably in the plot pane of Spyder), how do you do it? I've tried various methods to redraw the plots,for example
plt.show()
plt.draw()
bp.get_figure().canvas.draw()
but none of these updates the image in the plot pane. I figured that even if I can't update the image, I should at least be able to redraw it (i.e a 2nd image appears in the plot pane with the update characteristics). But nothing I've tried worked so far. Please advise and thanks again.
(Spyder maintainer here) About your questions:
Do plots only update/refresh by line codes in the IPython console if the Graphics Backend is not static like inline?
Correct.
Why do I get different result when I run code blocks vs line by line?
Because when you run code cells (which is what I think you mean by "code blocks") your plot is shown at the end of that code and hence it takes all modifications you've done to it in intermediate lines.
If it is possible to update the inline plots (preferably in the plot pane of Spyder), how do you do it?
No, it's not possible. As you correctly mentioned above, inline plots are static images, so they can't be modified.

gnuplot cannot set terminal to gif

I am trying to generate a GIF using gnuplot.
I downloaded and installed gnuplot version 5.0.6 from sourceforge, and am trying to run this example:
Creating gif animation using gnuplot
However I can't seem to be able to set terminal to gif, gif is not one of the available options under set terminal.
Has anyone encountered this, and figured out how to enable gif option in gnuplot?

how to keep proportions in jpeg image when importing it to rstudio

Is there any way to import a jpeg image in Rstudio or R and keep its original proportions? The following way used to work for me, but not anymore.
require(jpeg)
image=readJPEG(system.file("img", "Rlogo.jpg", package="jpeg"))
plot(1, type="n", xlim=c(1, ncol(image)), ylim=c(1, nrow(image)))
rasterImage(image,xleft=1, xright=ncol(image), ybottom=1, ytop=nrow(image))
Thanks in advance.
Make sure your underlying plot has a fixed aspect ratio of one.
plot(1, type="n", xlim=c(1, ncol(image)), ylim=c(1, nrow(image)), asp=1)
Otherwise the plot will just stretch to whatever aspect ratio the graphics window is, and the raster is "glued" to the plot such that it stretches too.

Octave + Gnuplot rendering image upside down

I am displaying data using function imagesc(). If I set fltk as graphics_toolkit image is displayed correctly.
Can't post images directly(low reputation) http://i.stack.imgur.com/ARiwF.png
If I use gnuplot as plotting program image is rendered upside down.
fltk is unusable for me because its window isn't responding while function in octave is running. I also tried plot sine and it was correct plotted through fltk and gnuplot too.
There are at least two workarounds:
Use axis("xy") or axis("ij") to control the orientation of the y-axis, as decribed in the axis documentation
Use set(gca, "ydir", "normal") or set(gca, "ydir", "reverse"), as decribed in the axes properties doc

How to save images drawn in Python turtle module that are outside screen area

I am new to Python. I wrote a Python code using turtle module, but when i am trying to save the image, the part of the image that is visible in the screen is only getting saved, the parts that are outside are getting cropped. I am saving using the following command:
turtle.getcanvas().postscript(file = "filename.eps")
I have also tried to resize the turtle screen using turtle.screensize() to make it bigger than the drawn image, but then also the part of the image that was saved was the part visible in the screen only.
Please help,
Try setting the height and width arguments.
turtle.getscreen().getcanvas().postscript(file='outputname.ps', height=10000,
width=10000)

Resources