in gnuplot terminals wxt and pngcairo nor available - linux

I installed gnuplot version 4.6.6.
After that the terminals "wxt" and "pngcairo" were no longer available. The time before I have been working a lot with these two terminals with version 4.4 and with very good results.
How can I get these two terminals working with gnuplot version 4.6?
In the following I try to answer a question of Christoph:
I am working with Linux, with an old version of Kubuntu (Ubuntu 11.10 "oneiric").
I downloaded "gnuplot-4.6.6", unpacked it and read the File "INSTALL".
From this long text I read only the following lines:
----------------------------------------------
Unix, configure
---------------
On Unix, use
$ ./configure
$ make
[ Optionally run demos--see "How to test gnuplot" below. ]
$ make install
-----------------------------------------------
and also the following lines:
----------------------------------------------------------
Linux
-----
Ubuntu:
./configure fails to find lua support because Ubuntu packages it as
"lua5.1" rather than "lua". You can fix this by adding a symlink
prior to running ./configure
ln -s /usr/lib/pkgconfig/lua5.1.pc /usr/lib/pkgconfig/lua.pc
-----------------------------------------------------------
So I applied the following statements (as root):
'ln -s /usr/lib/pkgconfig/lua5.1.pc /usr/lib/pkgconfig/lua.pc'
./configure
make
make install
All these statements produced a lot of output, but no problems were indicated.
The executable binary program is located in "/usr/local/bin".
My old gnuplot 4.4 is located in "usr/bin".I installed gnuplot version 4.6.6. After that the terminals "wxt" and "pngcairo" were no longer available. The time before I have been working a lot with these two terminals with version 4.4 and with very good results.
How can I get these two terminals working with gnuplot version 4.6?

Related

Pyplot does not show plots in WSL (Ubuntu 18) [duplicate]

So it seems on ubuntu for windows (windows subsystem for linux) people are suggesting we need to use Agg backend and just save images, not show plots.
import matplotlib
matplotlib.use('Agg') # no UI backend
import matplotlib.pyplot as plt
import numpy as np
t = np.arange(0.0, 2.0, 0.01)
s = 1 + np.sin(2*np.pi*t)
plt.plot(t, s)
plt.title('About as simple as it gets, folks')
#plt.show()
plt.savefig("matplotlib.png") #savefig, don't show
How could we get it to where plt.show() would actually show us an image? My current option is to override plot.show() to instead just savefig a plot-148123456.png under /mnt/c/Users/james/plots/ in windows and just have an explorer window open viewing the images.
I suppose I could host that folder and use a browser.
My goal is to be able to run simple examples like the code above without changing the code to ftp the images somewhere etc. I just want the plot to show up in a window.
Has anyone figured out a decent way to do it?
Ok, so I got it working as follows. I have Ubuntu on windows, with anaconda python 3.6 installed.
Download and install VcXsrv or Xming (X11 for Windows) from sourceforge(see edit below)
sudo apt-get update
sudo apt-get install python3.6-tk (you may have to install a different python*-tk depnding on the python version you're using)
pip install matplotlib (for matplotlib. but many other things now work too)
export DISPLAY=localhost:0.0 (add to ~/.bashrc to make permanent. see WSL2 below)
Anyways, after all that, this code running in ubuntu on wsl worked as is:
import matplotlib.pyplot as plt
import numpy as np
t = np.arange(0.0, 2.0, 0.01)
s = 1 + np.sin(2*np.pi*t)
plt.plot(t, s)
plt.title('About as simple as it gets, folks')
plt.show()
result:
Maybe this is better done through a Jupyter notebook or something, but it's nice to have basic command-line python matplotlib functionality in Ubuntu for Windows on Subsystem for Linux, and this makes many other gui apps work too.
For example you can install xeyes, and it will say to install x11-apps and installing that will install GTK which a lot of GUI apps use. But the point is once you have your DISPLAY set correctly, and your x server on windows, then most things that would work on a native ubuntu will work for the WSL.
Edit 2019-09-04 : Today I was having issues with 'unable to get screen resources' after upgrading some libraries. So I installed VcXsrv and used that instead of Xming. Just install from https://sourceforge.net/projects/vcxsrv/ and run xlaunch.exe, select multiple windows, next next next ok. Then everything worked.
Edit for WSL 2 users 2020-06-23
WSL2 (currently insider fast ring) has GPU/docker support so worth upgrade. However it runs in vm. For WSL 2, follow same steps 1-4 then:
the ip is not localhost. it's in resolv.conf so run this instead (and include in ~/.bashrc):
export DISPLAY=`grep -oP "(?<=nameserver ).+" /etc/resolv.conf`:0.0
Now double-check firewall: Windows Security -> Firewall & network protection -> Allow an app through firewall -> make sure VcXsrv has both public and private checked. (When Launching xlaunch first time, you might get a prompt to allow through firewall. This works too. Also, if VcXsrv is not in list of apps, you can manually add it, eg from 'C:\program files\vcxsrv\vcxsrv.exe')
Launch VcXsrv with "Disable access control" ticked
Note: a few WSL2 users got error like couldn't connect to display "172.x.x.x:0". If that's you try to check the IP address stored in DISPLAY with this command: echo $DISPLAY. If the showed IP seems to be wrong (i.e. "8.8.8.8" or another not working IP address) you need to change the code in ~/.bashrc showed in the point 5 to something that will get your instance's ip address. One user said this worked: export DISPLAY=$(ifconfig | grep inet | awk '{print $2}' | head -n 1 | awk '{print $0":0"}'). However for some others it did not work. YMMV, but just find your IP and use if for DISPLAY. For most WSL2 users, the command in #5 works.
Edit for Windows 11 : if MS convinced you to throw out your old computer and buy one with a TPM and so you got Windows 11, you get GUI for free. I hope they add upgrade path to do that on Windows 10 because Win10 will be like XP and last a long time since MS decided you need recent computer even though Win11 would work fine on old computers.
Plots are also viewable on WSL using Visual Studio Code, which as of the June 2019 release, includes a "Plot Viewer".
In a regular .py file, inserting a comment string #%% marks the code as a Jupyter (IPython) cell and a code lens shows options to Run Cell. In addition, right-clicking inside a Python file includes the option:
Run Current File in Python Interactive Window
From the VS Code June 2019 release:
The June 2019 update included a brand-new Plot Viewer that can be used
to manipulate any image plots, such as the popular matplotlib plots.
You can try it out by double-clicking on the plots or clicking on the
“expand image” button that is displayed when you hover over plot
images in the Python Interactive Window:
With the plot viewer, you can pan, zoom in/out, navigate through plots
in the current session, and export plots to PDF, SVG, or PNG formats.
For WSL2 using Ubuntu Focal Fossa release, I downloaded and installed VcXsrv on Windows. I use this configuration:
I don't know for Native OpenGL but it seems important to disable access control.
Now, you need to export the env variable DISPLAY in WSL.
I found the correct address in /etc/resolv.conf, but the one found in the ifconfig result isn't. So the following command doesn't work for me:
export DISPLAY=$(ifconfig | grep inet | awk '{print $2}' | head -n 1 | awk '{print $0":0"}')
That IP address can also be found in the command ipconfig into CMD.exe command context. Search for vEthernet (WSL), that should be the one.
Now, you can test that everything is working by simply executing xcalc in your WSL environnement. If xcalc is not present, install it:
sudo apt-get update && sudo apt-get install x11-apps
xcalc command should open a application looking like this on Windows:
If it is working that means that the connection to your X-server is possible but you maybe need to install some extra package for Python like:
sudo apt-get install python3.x-tk
Change .x according to your python version.
To get matplotlib to work with GTKAgg on Bash on Ubuntu on Windows, I:
installed VcXsrv under Windows (but things should work just the same with Xming)
set DISPLAY as noted above [export DISPLAY=localhost:0.0 (add to ~/.bashrc to make permanent)]
executed sudo pip uninstall matplotlib
followed by sudo apt install python-matplotlib
updated matplotlibrc to read backend : GTKAgg (rather than backend : agg)
I also ran sudo apt-get install python-gtk2-dev, but this may not be necessary.
Uninstalling the pip-installed matplotlib and reinstalling it via apt appear to be necessary because pip does not include the C extensions needed to run GTK, but the apt version does.
With Windows 11 22000, Linux GUI apps are officially supported out of the box provided pre-requisites are met. No twaeks, No hacks, No firewall changes etc.
Pre-Requisites:
Windows 11 Build 22000 or higher
Installed driver for vGPU (Intel/Nvidia/AMD)
Then run the commands
wsl --update
wsl --shutdown
Done !!
Official Source : https://learn.microsoft.com/en-us/windows/wsl/tutorials/gui-apps
In my case (Windows 10, WSL2, Ubuntu 20.04 with miniconda3 and virtual environment where I installed all the required Python 3.6 packages using conda command, Windows-based Visual Studio Code with 'Python' and 'Remote - WSL' extensions) I installed VcXsrv under Windows, and added
export DISPLAY=$(awk '/nameserver / {print $2; exit}' /etc/resolv.conf 2>/dev/null):0
to .bashrc file in Ubuntu. Also, before running Python code from WSL, we have to launch XLaunch and select 'Disable access control' (I left 'Native opengl' checked as well). In project folder, do not name your Python file as matplotlib.py (some related issues are reported here).
In two seperate instances (wsl1 & wls2 with ubuntu 20.04) while using PyQt5 I was missing several libxcb libraries (e.g. libxcb-icccm4) which was not printed when trying to plot. I used export QT_DEBUG_PLUGINS=1 to find out which ones and then simply installed them. Basically the steps here.
had similar problem so simply installing the supported gpu driver solved my problem. Check this out!
I found the best approach is to install Jupyter on Windows Subsystem for Linux (WSL) by following
sudo apt update && upgrade
sudo apt install python3 python3-pip ipython3
Now you can install matplotlib
pip3 install matplotlib
And Jupyter Notebook
pip3 install jupyter
Check this link if you need more info Python setup on the Windows subsystem for Linux (WSL)

How does ncurses search for terminal descriptions

I'm building ncurses 6.1 from source for some reasons. First I configure the sources with
./configure
and then I build it with
make
both without arguments. When I try to run tests I get the error message
Error opening terminal: xterm-256color.
on my local system (Ubuntu 17.10) and
Error opening terminal: xterm
on the build server (Jenkins Docker container).
I found out that this build is looking for terminal descriptions in /usr/share/terminfo/. There are many descriptions but no xterm-256color on my local system. On the build server the folder /usr/share/terminfo/ is empty. I found xterm-256color and xterm at /lib/terminfo. When I install ncurses with package manager (apt for Ubuntu 17.10), it works. So I assume that this package chooses the right path. I copied xterm-256color resp. xterm from /lib/terminfo to /usr/share/terminfo/ and my build works on both systems now. Why do two different paths exist and why do these two versions of ncurses choose two different paths? I need a conan package of ncurses that works out of the box without copying description files.
This could be a duplicate of:
How to set custom search paths for the terminfo database when building ncurses from source
The answer is in the summary at the end of configure (which isn't shown in the question). But running infocmp -D will show the directories that infocmp would use when looking for descriptions.
You can modify the behavior using the TERMINFO and TERMINFO_DIRS environment variables.
The /lib/terminfo is Debian-specific (Ubuntu doesn't provide any changes for ncurses; they simply recompile the Debian packages: most Ubuntu bug reports for ncurses deal with their problems in doing that).
Debian by default installs someone's notion of a minimal terminal database in that directory. Install ncurses-term to get a full terminal database.
By the way, compiling and installing ncurses on Debian/Ubuntu/other systems with ncurses already installed runs a risk of breaking the existing libraries which are used (for example) by bash and other utilities that you probably need.

how to compile gnuplot 5.0 with png -r pngcairo terminals

I have tried to compile gnuplot 5.0. Once finish compile I check for available terminals. There in the list I could not see terminal png or pngcairo. I also tried some options given in the release note for version 5 (http://www.gnuplot.info/ReleaseNotes_5_0.html). Unfortunately, that could not help me.
I am using ubuntu 14.04 and previously I used gnuplot ver 4.6.
Hope I could get some help.
Thanks

gnuplot cursor not moving on OSX 10.9?

I have recently installed OSX 10.9, with the latest version of XQuartz and gnuplot 4.6.4
When I move the cursor across the gnuplot window the coordinates shown in the bottom left corner do not update. I am testing this using plot sin(x). The desired functionality I am describing is seen here.
I believe that this was working under OSX 10.7, so I am not sure what is the problem.
Installing gnuplot through macports instead of building from the official sourceforge download site solved the issue.
I also installed the wxt terminal while I was at it since it offers some improved features, but x11 works fine too. (Thanks #Christoph for bringing me to learn about wxt).
Instructions:
Install macports
Open the terminal and enter port variants gnuplot followed by sudo port install gnuplot +wxwidgets
(Note: the installation may take a while, but is all automated)

bad quality of picture in gnuplot 4.6.1

I have just shifted from gnuplot 4.4 to 4.6.1. And unluckily found that all the pictures in x11 terminal have lost in quality pretty much (low resolution). It seems to me smth is wrong with configuration of gnuplot (I compiled 4.6 from sources and did not apply any options to configure).
Has anybody encountered with such problem?
Best regards,
Alexander
upd:
here are the screenshots of 4.2 and 4.6 respectively:
https://picasaweb.google.com/102562667690948164683/212012?authkey=Gv1sRgCPj9s7CH1Z3LgAE#5813182842354188578
https://picasaweb.google.com/102562667690948164683/212012?authkey=Gv1sRgCPj9s7CH1Z3LgAE#5813182919536461282
The wxt terminal is indeed what you want.
It is enabled by default in the 'configure' script, so I assume you were missing one or more libraries it depends on, when you ran it. I just tried it with version 4.6.1 from sourceforge.
The confgiure script gives you a list of requirements for the wxt terminal to be enabled. Look for the line
wxt terminal: no (requires C++, wxWidgets>2.6, cairo>0.9, pango>1.10)
You need C++ (I assume you have that). For the others, on my almost clean Ubuntu 12.10 64bit installation, I needed to install 3 additional packages with their dependencies to enable the wxt terminal option. You want:
libcairo2-dev
libpango1.0-dev
libwxgtk2.8-dev
On debian-based distributions, you can do:
sudo apt-get install libcairo2-dev libpango1.0-dev libwxgtk2.8-dev
or install them manually on other systems. If you don't find them in your repositories, you can always get the latest versions from wxWidgets,cairo and pango. When you have the libraries installed, re-run ./configure and check that the wxt terminal line reads
wxt terminal: yes
If it does, re-compile your gnuplot by make and make install and you can use gnuplot as before with nice output on the screen.
Try "set term wxt". It works as a replacement for the x11 term and is likely to have better quality.

Resources