i am printing some png pictures with png cairo terminal:
set terminal pngcairo enhanced transparent size 1440,900 crop font "Palatino,27"
as a splot:
set tmargin at screen 1; set bmargin at screen 0; set lmargin at screen 0;
set view map; set size ratio -1; unset border;
set output 'pic.png'
splot 'datafile.bin' binary with pm3d
so i want a picture with absolutely no border. I both use the crop options and set margins to 0. Nevertheless, a small white border always remains all around the picture.
Any idea to get rid of it?
Many thanks
Generally, it could give problems if you explicitely set the margins and you also constrain the plot ratio (set size ratio -1).
The following is a self-contained script (doesn't need any additional data file), which shows the same problem.
set terminal pngcairo transparent crop size 1440,900
unset border
unset tics
unset colorbox
set size ratio -1
set pm3d map
unset key
set output 'pic.png'
set isosamples 20
set samples 20
set yrange [-10:10]
set xrange [-20:20]
splot x**2 + y**2 with pm3d
With the pngcairo terminal, this leaves a small border around the whole image. Using the png terminal works fine (tested with 4.6.0, 4.6.6 and 5.0.0).
To me, this seems to be a bug of the pngcairo terminal.
Related
I have enabled the MiniMap in Visual Studio Code (VSCODE) with the following code:
"editor.minimap.enabled": true
But can I make it bigger? It's so small at the right.
thanks Alex there is a new setting from VSCode release 1.40.0 onwards:
"editor.minimap.scale": 2
before VSCode 1.40.0:
there is no zoom-level for the minimap.
But i think the following settings is useful as it renders it schematically which looks much nicer than with true! Maybe this improves it! ;-)
"editor.minimap.renderCharacters": false
In the settings, you can set the width with
// Limit the width of the minimap to render at most a certain number of columns
"editor.minimap.maxColumn": 120
From vscode release 1.40.0
"editor.minimap.scale": 2,
There are two new minimap settings which are in v1.43:
Editor › Minimap: Size
values: proportional, fit and fill
From https://github.com/microsoft/vscode-docs/blob/vnext/release-notes/v1_43.md#minimap-size:
When set to proportional (the default), each line gets a certain
amount of vertical space in the minimap, depending on
editor.minimap.scale. For example, on a high-DPI monitor, with a
configured scale of 1 (the default), each line gets 4 px in the
minimap. So for a file of 100 lines, the height of the lines rendered
in the minimap is 400 px, and for a file of 1000 lines, it is 4000 px.
That means that for large files, the minimap will also scroll, as the
current file is scrolled.
When set to fit, the height of the minimap
is limited to never be larger than the editor height. So if a file has
many lines, they will be sampled and only a subset will be rendered in
the minimap, such that there is no need for the minimap to scroll.
When set to fill, the height of the minimap is always the editor
height. For large files, this is also achieved by sampling lines, but
for small files, this is achieved by reserving more vertical space for
each line (stretching the lines).
Here the size is changed from proportional to fit, and then in a smaller file, from fit to fill:
Not yet, but the pull request is on its way https://github.com/microsoft/vscode/pull/82265
The text in my WKInterfaceLabel is way too long and causes the text to be cut off with dots at the end. I know for UILabel for iOS you can easily resolve this issue by enabling clip mode. I don't believe there is any way for me to resolve this for watchkit. This is going to force me to use an Image if I can't prevent the text from being cut off. Any tips or suggestions is appreciated.
You have a couple options depending on how you want the view to respond. In your interface story board select your label and open the attributes inspector.
Your first option is to change the font to a smaller size. This is more for a static label that you want to style and leave set.
Your second option is to adjust the min scale value, changing this will automatically shrink the text to fit the window up to the value provided. For example if your font size is 12pt and you set the scale to .5, the font will shrink up to 6pt before appending the ellipsis (...).
Your third option is to set the number of lines to 0 (or a higher number). This will move the text down onto the next line.
Set the number of lines to 0 and ensure the label and any containing groups are set to fit content.
if you want your font size adjust according to label size follow this method
in WKInterfaceTable attribute inspector set min scale to 0
like in screen shoot
Result before Min scale = 0
Result after Min scale = 0
Note: your no of lines also set to 1
Now I installed the gnuplot version 4.6 and want to draw some histogram chart using the tkcanvas terminal, but find some commands don't work:
set style fill solid 1.0
But the bar is still empty inside
title
Maybe it is related to the first issue. but in the legend part, beside the title text no bar placed beside to show which color it denotes.
set xtics rotate by -45
The labels along x axis has no rotation
Here is a short example:
set term tk
set style data histograms
set style histogram clustered
set style fill solid 1.0 border lt -1
set xtics rotate by -45
plot for [col=2:5] "histogramdata.txt" using col:xticlabels(1) title columnheader(col)
OK, based on my study I find what the issue. yes, when use tkcanvas as the terminal, the set style fill solid and set xtics rotate both failed. Them can work well for x11 terminals
so the name for this post should be tkcanvas cann't support gnuplot command like: set style fill....
Any idea?
You are doing nothing wrong, the tkcanvas terminal simply doesn't support filled polygons and rotated text, as the test command also tells you:
To see this, use the simple script
set terminal tkcanvas
set output 'test.file'
test
And then, after invoking wish, execute the following Tcl/Tk commands:
source test.file
canvas .c
pack .c
gnuplot .c
which on my system gives
I am currently writing up a scientific thesis and am very desparate about creating figures that have the exact dimensions I want them to have. Especially the font sizes do not match.
I already googled alot and there are a bunch of guides and scripts about this topic but nothing really helped - I have not yet figured out (sorry) why my approach does not work:
FS=8; %font size in points (the same as in my document)
width=12; %width of figure in cm
height=4; %height of figure in cm
scatter(1:20,rand(20,1));
xlabel('X','fontsize',FS),ylabel('Y','fontsize',FS),title('X vs. Y','fontsize',FS)
%now I scale the figure and place it in the bottom left corner. The white margins around it are cropped automatically
set(gca,'units','centimeters','outerposition',[0 0 width height])
%export as .eps
print(gcf,'-depsc','test')
When I load test.eps into Inkscape, the figure is 10.16 x 3.529 cm large and the font sizes (of title and axis labels) are 10.
How do I get a figure with the exact scaling, especially regarding the font size?
I did the following:
FS=8; %font size in points (the same as in my document)
width=12; %width of figure in cm
height=4; %height of figure in cm
scatter(1:20,rand(20,1));
set(gca, 'fontsize', FS);
xlabel('X','fontsize',FS),ylabel('Y','fontsize',FS),title('X vs. Y','fontsize',FS)
set(gcf,'units','centimeters','position',[0 0 width height])
export_fig(gcf, 'test.pdf', '-transparent', '-nocrop')
The output figure is 12cm x 4cm. The font size still claims to be 10 in Inkscape, however, but it looks the same size as that in the figure. Export_fig can be downloaded from the MATLAB file exchange.
Here is how I solve it as of now - it is not exactly elegant but it works...
I plot my figure and arrange and scale it in the figure window the way I want it to be scaled:
set(gcf,'units','centimeters','position',[0 0 width height])
Due to the white margins around the axes, I increase the width/height by approximate (trial and error...) values that the margins use up. I then export it:
export_fig(gcf,'test','-eps','-transparent')
And load it into Inkscape. Now I set the document properties so that the document has the exact size I want my figure to have - the figure is partly out of this frame because I increased the width/height earlier.
Then I arrange the axes to have as much white space between them as I want them to have; hopefully, everything is inside the document borders after that.
Probably the drawing is smaller than the document borders now - to ensure that it will not get expanded, messing up the scaling, when I put it in my actual document (my thesis, not the Inkscape document...), I simply create a white background that matches the document borders. Aaand done.
Except for the fontsize and fontname properties in Matlab - I have not figured out why they are not properly exported...but this is not hard to manually fix in Inkscape.
Thanks for your help, everyone.
This appears to be a trivial problem but the result is strange, totally lost where I am going wrong. There is an input RGB image which needs to be converted to gray scale and sized to 1000 x 1000 pixels. This is how I have done
img=imread('flowers.jpg');
flowers_gray=rgb2gray(img);
flowers_resize=imresize(flowers_gray,[1000 1000]);
but strangely the output image is not of 1000 by 1000 pixels. Moreover, matlab did not save the image (tried using SaveAs option and the File --->Export Setup) gray scale mode
and also the size was incorrect since when I opened the saved image by
img1=imread('flowers_resize.jpg')
s=size(img1)
it gave
s=586 665 3
And the image flowers_resize.jpg is saved with a white border surrounding it in the image folder. So, I went to Paint toolbox to select the image A1 and manually deleted the surrounding background and resized the image.But alas, it saved the image with 3 color channels and not in gray scale mode although the size was correct! Can somebody please point out the correct way of resizing to 1000 by 1000 pixels and saving in gray scale mode without the white border surrounding the saved output file? Thank you.
When you use the image export processing, you are saving the entire figure including the space around the figure (white space).
Instead, use the imwrite command. In your case:
imwrite(A1,'flowers_resize.jpg','jpg');