mouse in gnuplot x11 - zooming

I noticed that I can use the right button of the mouse in order to zoom in a plot in gnuplot, with the terminal X11.
I don't find any documentation for the other mouse gesture.
For example, it would be fine to do some zoom out!
Could you suggest this?
Best,
Al.
EDIT:
Apparently, the only possibility is to zoom in with the right mouse button and use the key p to come back, as Christoph suggested.

Yes, the documentation is not very clear about this. You can find some information about this under help mouse (type this in the interactive gnuplot terminal, or see the section Mouse in the pdf). This shows you for example, that you can use the mouse wheel for scrolling in x and y direction as well as zooming (help mouse scrolling).
To get all the gestures, type show bind, which gives me (Linux, 4.6.4):
gnuplot> show bind
2x<B1> print coordinates to clipboard using `clipboardformat`
(see keys '3', '4')
<B2> annotate the graph using `mouseformat` (see keys '1', '2')
or draw labels if `set mouse labels is on`
<Ctrl-B2> remove label close to pointer if `set mouse labels` is on
<B3> mark zoom region (only for 2d-plots and maps).
<B1-Motion> change view (rotation). Use <ctrl> to rotate the axes only.
<B2-Motion> change view (scaling). Use <ctrl> to scale the axes only.
<Shift-B2-Motion> vertical motion -- change xyplane
<wheel-up> scroll up (in +Y direction).
<wheel-down> scroll down.
<shift-wheel-up> scroll left (in -X direction).
<shift-wheel-down> scroll right.
<control-wheel-up> zoom in toward the center of the plot.
<control-wheel-down> zoom out.
<shift-control-wheel-up> zoom in only the X axis.
<shift-control-wheel-down> zoom out only the X axis.
Space raise gnuplot console window
q * close this plot window
a `builtin-autoscale` (set autoscale keepfix; replot)
b `builtin-toggle-border`
e `builtin-replot`
g `builtin-toggle-grid`
h `builtin-help`
l `builtin-toggle-log` y logscale for plots, z and cb for splots
L `builtin-nearest-log` toggle logscale of axis nearest cursor
m `builtin-toggle-mouse`
r `builtin-toggle-ruler`
1 `builtin-previous-mouse-format`
2 `builtin-next-mouse-format`
3 `builtin-decrement-clipboardmode`
4 `builtin-increment-clipboardmode`
5 `builtin-toggle-polardistance`
6 `builtin-toggle-verbose`
7 `builtin-toggle-ratio`
n `builtin-zoom-next` go to next zoom in the zoom stack
p `builtin-zoom-previous` go to previous zoom in the zoom stack
u `builtin-unzoom`
Right `builtin-rotate-right` only for splots; <shift> increases amount
Up `builtin-rotate-up` only for splots; <shift> increases amount
Left `builtin-rotate-left` only for splots; <shift> increases amount
Down `builtin-rotate-down` only for splots; <shift> increases amount
Escape `builtin-cancel-zoom` cancel zoom region

I know this is an old post, but I've been having the trouble of the graph being too large for the gnuplot window (Version 4.6 patchlevel 6).
The solution I found was to hold down the scroll wheel and pan left or right to zoom out and in respectively.
Hope it helps.

Related

pyautogui / pyscreeze - locate works w/o region parameter, but doesn't work w/ region parameter

Using pyautogui, I'm trying to locate an image on screen.
This finds the image (on primary monitor w/ 2560x1440 resolution), but takes nearly 5 sec:
icon1 = pyautogui.locateOnScreen('[filepath]\\icon1.png', grayscale=True)
To reduce search time, I provide a region parameter, but this doesn't find the image. It executes in ~0.7 sec
icon1 = pyautogui.locateOnScreen('[filepath]\\icon1.png', region=(1500,100,950,1100), grayscale=True)
Eliminating the grayscale parameter doesn't change the result - still ~0.7 execution time and image not found:
icon1 = pyautogui.locateOnScreen('[filepath]\\icon1.png', region=(1500,100,950,1100))
Then I tried setting the region parameter to the entire screen, but image not found and execution time is ~1.5sec, so it's searching (judging by longer execution time w/ larger region), just not finding.
icon1 = pyautogui.locateOnScreen('[filepath]\\icon1.png', region=(0,0,2559,1439))
Any suggestions on what to try next? Thanks.
I figured out what's happening. As a preface, I am working with multiple monitors, and have made modifications to pyautogui and pyscreeze as described in these 2 pyautogui github comments:
https://github.com/asweigart/pyautogui/issues/9#issuecomment-527236475
https://github.com/asweigart/pyautogui/issues/321#issuecomment-629819495
With these modifications, pyautogui works with multiple monitors, and pyautogui.position() and pyautogui.moveTo() treat the upper left corner of the primary monitor as coordinate (0,0) - this means monitors above or to the left of primary monitor will have at least one negative coordinate.
But pyscreeze is returning image search results based on treatment of the upper left corner of the upper left monitor as coordinate (0,0) - so all coordinates on extended desktop are positive.
The region parameter I was passing to locateOnScreen() was based on using pyautogui.position() reported coordinates, so the search was being executed on an incorrect area of the screen.
Once I figured that out, I was able to pass the correct region specification.
To illustrate, I inserted a print statement in pyscreeze to show where the image is found. And a print of the image search return. And in my code, I printed pyautogui.position().
retVal = Box(left=8008, top=3171, width=29, height=31)
Point(x=4182, y=1026)
mouse position:
Point(x=4182, y=1026)
So you can see that coordinates are quite different. Pyscreeze is showing coordinates based on 0,0 being upper left corner of upper left monitor, while the image search return variable are coordinates based on 0,0 being upper left corner of primary monitor, so I'm able to take the image search result variable and pass that to pyautogui.moveTo() and move the mouse there (moveTo needs coordinates based on 0,0 being upper left corner of primary monitor).
The issue stems from adopting changes from two different people to pyautogui and pyscreeze. I suppose I could adjust the changes to one of these packages to offset the coordinates so that both are referencing the same monitor's upper left corner as coordinate (0,0).
Your region is set wrong. Use (0,0,2559,1439).
And if this doesn't work make a new screenshot specifying the region for it, save it and look if that just captured screenshot would be found on the screen.
The code below should always work as expected:
from time import perf_counter as T
import pyautogui
# NOTICE that in pyautogui: region=(left, top, width, height)
pyautogui.screenshot('pyautogui_region_screenshot.png', region=(300, 500, 300, 200))
sT = T()
img = pyautogui.locateOnScreen('pyautogui_region_screenshot.png', region=(300, 500, 300, 200))
eT = T()
print(f'img = pyautogui.locateOnScreen took: {eT-sT:9.5f} seconds')
print(img)
By the way: check out https://stackoverflow.com/questions/72410958/taking-a-screenshot-of-a-specific-portion-of-the-screen-in-python to switch to another Python module ( mss ) for doing screenshots of small regions of the screen.
https://pyautogui.readthedocs.io/en/latest/screenshot.html

Jittering lines when scrolling a TMX map in cocos2d-x

I feel like I'm missing some fundamental concept as to why I am getting flickering when moving a tile map around.
I create a layer. In it, I add a TMXTiledMap.
_tileMap = TMXTiledMap::create("TMX/32Map.tmx");
_tileMap->setScale(1.f);
_floorLayer = _tileMap->getLayer("Floor");
this->addChild(_tileMap);
for(const auto& l : _tileMap->getChildren()) {
static_cast<SpriteBatchNode*>(l)->getTexture()->setAliasTexParameters();
}
this->scheduleUpdate();
In the update I move the layer.
Vec2 newPos = this->getPosition();
newPos.x = (newPos.x - 1);
newPos.y = (newPos.y - 1);
this->setPosition(newPos);
I realize I'm not moving it by dt. If I move it by dt I get an overall jumpiness to the whole layer. I understand this is due to how it renders partial pixels. But if I move it by one pixel like above, I get this # looking set of lines on the screen about 64 pixels or so on top and bottom and about 224 pixels from the left and right
That is when the window is 1024x768. If I make a 320x240 window, I don't see the lines and if I make it 640x480 I only see them on the left and right sides right near the edge of the screen.
Ultimately I'd just like to smoothly scroll a tile map around. Any help would be super appreciated, because I just can't seem to get started on this project.
For me working solution was to change CC_FIX_ARTIFACTS_BY_STRECHING_TEXEL in ccConfig.h from 1 to 0. Find ccConfig.h in cocos/base/.

gnuplot how to zoom y & y2 axis

I have a plot like this using wgnuplot:
the green and blue are on y2 axis.
Question 1:
When I zoom using right mouse button I get:
The black line on yaxis is to compressed near top. How can I get the y scale to fit the data for this window at this point AUTOMATICALLY. I.e.e without me having to type range commands?
Questions 2:
Again, is there anyway to rescale/zoom the y2axis ALONE, by mouse?
Just press 'a' or click the autoscale button to adjust the y-scale. Maybe you want to use set autoscale xfix before that.
Its not by mouse, but you can use the bind command to rescale only the y2-axis with the hotkeys 'alt-z' and 'alt-y':
bind 'alt-z' 'set y2range[GPVAL_Y2_MIN*2:GPVAL_Y2_MAX*2]; replot'
bind 'alt-y' 'set y2range[GPVAL_Y2_MIN*0.5:GPVAL_Y2_MAX*0.5]; replot'

Translating flash info box into coordinates for html5 canvas shape?

I'm trying to recreate some flash shapes that appear on rollover upon a circle symbol. I'm needing to convert flash x and y points to the canvas coordinate grid. I figured out how to convert the circle coord points. However, the info I'm given for the shapes that appear on rollover make no sense to me.
For example, take this rollover point, where the dimensions refer to the registration point (little cross in the upper left):
x = 532.30
y = 30.35
w/h = 19.80
But based off this, the info I get for the rectangle that appears on rollover makes no sense:
x = -7.30
y = 17.30
w = 29.0
h = 16.5
I figured this meant that the rectangle's upper left point was 7.30 pixels to the left, and 17.30 pixels down from the registration point of the circle. Is that right? What origin are these x and y coordinates based off of?
The width and height are completely confusing to me though. The given width is 29.0, but this can't be right. If I get x and y coordinates just using my cursor, its clear that the rectangle is much wider than this:
564 - 521 = 43
43 != 29
Please help me understand the mysterious info box I'm being presented with for this rectangle. I just need to get some vanilla coordinates for it so I can draw it on the HTML5 canvas.
What origin are these x and y coordinates based off of?
These x and y coordinates are based off of the registration point of tab button.
43 != 29
When you work with symbols on a stage, the symbols that you're working with aren't the actual original Library symbol. They're copies that can be manipulated by scaling them, applying color and opacity effects and...
This instance of tab button is scaled, if you open library panel and edit tab symbol you can see the actual size.
UPDATE
after I change width and height of tab button to 19.80:
29*(150/100)=43.5

Zoom out in Octave / gnuplot

I use Octave with gnuplot under Windows.
I can zoom in using the right mouse button. But how can I zoom out from the UI?
I found this post on Nabble. Pressing p takes you to the previous zoom level, n to the next level, and u unzooms. I pressed h in a gnuplot window outside of Octave and got this command list:
2x<B1> print coordinates to clipboard using `clipboardformat`
(see keys '3', '4')
<B2> annotate the graph using `mouseformat` (see keys '1', '2')
or draw labels if `set mouse labels is on`
<Ctrl-B2> remove label close to pointer if `set mouse labels` is on
<B3> mark zoom region (only for 2d-plots and maps).
<B1-Motion> change view (rotation). Use <ctrl> to rotate the axes only.
<B2-Motion> change view (scaling). Use <ctrl> to scale the axes only.
<Shift-B2-Motion> vertical motion -- change xyplane
Space raise gnuplot console window
q * close this plot window
a `builtin-autoscale` (set autoscale keepfix; replot)
b `builtin-toggle-border`
e `builtin-replot`
g `builtin-toggle-grid`
h `builtin-help`
l `builtin-toggle-log` y logscale for plots, z and cb for splots
L `builtin-nearest-log` toggle logscale of axis nearest cursor
m `builtin-toggle-mouse`
r `builtin-toggle-ruler`
1 `builtin-decrement-mousemode`
2 `builtin-increment-mousemode`
3 `builtin-decrement-clipboardmode`
4 `builtin-increment-clipboardmode`
5 `builtin-toggle-polardistance`
6 `builtin-toggle-verbose`
7 `builtin-toggle-ratio`
n `builtin-zoom-next` go to next zoom in the zoom stack
p `builtin-zoom-previous` go to previous zoom in the zoom stack
u `builtin-unzoom`
Right `builtin-rotate-right` only for splots; <shift> increases amount
Up `builtin-rotate-up` only for splots; <shift> increases amount
Left `builtin-rotate-left` only for splots; <shift> increases amount
Down `builtin-rotate-down` only for splots; <shift> increases amount
Escape `builtin-cancel-zoom` cancel zoom region
* indicates this key is active from all plot windows
https://www.gnu.org/software/octave/doc/v4.0.1/Introduction-to-Plotting.html
I use graphics_toolkit ("fltk") to zoom plots for octave running on linux.