Changing gnuplot x11 output defaults - gnuplot

I am using gnuplot over ssh (-X) and due to different screen resolution issues, my x11 output window has minuscule fonts. I want to access the .Xdefaults file as mentioned in documentation but cannot locate it. This question GNUPLOT_DRIVER_DIRECTORY pointed towards some solution but I don't want to input it every time. Can someone help me find a permanent fix for font sizes?

What is your default terminal ? I think it shoulds be xterm, to have x11 as defaults.
shell> echo $TERM
What is yout default gnuplot terminal display ?
gnuplot> show term
Instruction in ~/.Xdefaults have a special syntax (some example in linuxcertif.com/man/1/gnuplot/ ). But i think that's not what you want to do. This is more for 'fine tuning'. And i think it will only be effective if your default terminal is allready x11.
gnuplot*pointsize: 2
gnuplot*background: white
gnuplot*textColor: black
Anyway, it is better to use gnuplot with a text file : file.gp where you put your commands. Then just put in the beginning of your file :
set term x11 font "arial,15"
And execute your file with :
shell> gnuplot file.gp -
do not forget the 'dash' '-' at the end of the command, so that you can continue to put command in the gnuplot prompt to debug additional command.

Related

gnuplot : writing out particular settings into a "header"

It would be handy to have gnuplot write particular settings to an output file, ideally in a .svg, because svg appears very well suited for that - so the image file and settings are all together - however, it appears this is not feasible directly in gnuplot.
Working within the wxt and svg terminals, and especially multiplot, I have been able to see how gnuplot might interface with the shell (for example):
! ls ; pwd ; echo $0, print sin(pi), show terminal. Trouble happens though when trying usual redirection such as > foo.txt and such - even starting a separate gnuplot session by script just to get the parameters. In particular, I found this interesting :
output is sent to STDOUT
print output is sent to '<stderr>'
... though I'm not sure what to do with that.
I could use e.g. ! cat gnuplot.inp | grep terminal >> gnuplot.svg, and dig into further awk/sed scripting, but before doing that it would help to know if I'm missing any small details in gnuplot first. Thanks.
PS a trivial question : why is the shell in gnuplot sh, when the plain-old linux terminal shell I am using is bash and SHELL=/bin/bash? I notice that shell drops the session into the shell from which gnuplot was executed - not sure if that will help the task.
1 The usual way to save current settings to a file is the command save "filename". There is a script in the gnuplot repository called gpsavediff (it may or may not be included in your distro's gnuplot package) that compares the saved values to the default settings and keeps only the ones that changed. From a gnuplot session under linux a typical use would be
... do a bunch of stuff to make a plot ...
save "| gpsavediff > myplot.gp"
... do a bunch more stuff ...
# recover original plot
reset session
load "myplot.gp"
To write specific lines or text to a file is much simpler than you show. For instance
.
set print "session.log" append
print "# This plot looked good on the screen."
print "# At this point the view angles were ", GPVAL_VIEW_ROT_X, GPVAL_VIEW_ROT_Z
print "# I save a PostScript copy to foo.ps"
set term push
set term postscript color
set output "foo.ps"
replot
unset output
set term pop
...
When invoking a shell, gnuplot uses the libc library function popen(). The gory details of popen() are somewhat system dependent but you probably have a man page for it.
gpsavediff script here

Gnuplot Cannot open script file 'test.rtf'

I haven't found anything to my specific Problem with Gnuplot in other Threads. I want to load a text file on Mac. When I tell Gnuplot to
load '/Users/name/Desktop/test.rtf'
it always says Cannot open script file.
I already made sure, that I'm in the right working directory (I guess):
pwd
gives /Users/name
The text file contains:
plot sin(x)
and the standard terminal I'm using is
terminal type is wxt 0 enhanced
I hope someone can help me with that, since I'm not experienced in using programs with the terminal, so I really don't know how to solve my Problem right here.
first of all thanks for your answer! So I just managed to find my mistake, it seems that it has to do something with the notation, since I'm working on a german Mac. So
load 'file'
makes Problems, while
load "file"
works fine for me. Unfortunately I still have the Problem, that
set terminal postscript eps enhanced
set output "/Users/name/Desktop/testplot 2.png"
set encoding default
p sin(x)
set terminal wxt 0 enhanced
gives me a file, that can't be opened and it says the file is probably damaged or the format is not supported by 'preview'. It is not a huge problem actually since I can save the plot manually from the wxt terminal, but I really don't understand what Gnuplot is doing on OS X...

How can make screen sessions to use same settings as original terminal

When I run 'screen' command after logging into the linux terminal from putty,
I see font color of folders got changed.
earlier folders are shown with different color(blue)'
Now all files are in same color.
How can I make sure even screen sessions also use same font settings as original terminal?
There really isn't enough information to answer this question, but here's a couple things you could do to troubleshoot.
Make sure that the $SHELL in screen is the same as the $SHELL in the original terminal (Run echo $SHELL before and after starting screen and compare the results). Perhaps screen is running a different shell and thus not reading your preferred .*rc file.
Also, try starting screen with a specific TERM value. Set screen's term value to $TERM before when starting screen like so:
screen -T $TERM
I would also recommend trying to replace $TERM with xterm if $TERM doesn't solve it.

'tree' and 'ls' change text color on Linux command line

I've been having a peculiar issue caused by the tree command on Linux. When I call tree, the the color of the command prompt changes, and is only returned to normal by the ls command. I'm curious if others have encountered the same issue, and if they have fixes or workarounds. I'm using the solarized color scheme (though I'm not sure it's displaying entirely as intended) and I've confirmed that the issue arises on both xterm and gnome-terminal.
Thanks!
(Edit: I deleted the screenshot because it had some personal information)
The screenshot shows that the tree command is setting the foreground color, without resetting it.
The ls command does reset colors, sending
\e[0m
(where \e is the escape character). Call it a bug in tree. There is no general/portable method for restoring the original colors before a program is run. It is each program's responsibility to reset colors.

modifying font size using shell script

Is there any way to change the font size of terminal window(GNOME or KDE) from inside a shell script
Actually I want to display a file in a particular format on screens of all sizes.
Can i do it using scripts??
For KDE, you can use dcop to set your font size.
For example:
dcop konsole-8540 session-6 setFont Monospace,20,-1,5,50,0,0,0,0,0
(the 20 in the example above is the font size)
I for one would surely not want a shell script (or any other program for that matter) to change my terminal settings! If it were to find a way to do so, I would use it exactly once and them remove it from my machine.
Seriously: This is something you should not do, because the user will probably have set his or her screen size to the way it is for a reason that is probably better than yours for changing it. Consider handicapped people who might need a specific font or very large letters to be able to read the screen at all.
Better try and make your application suitable for any terminal layout - there are variables for telling you how many characters wide and how many lines high your current environment is.

Resources