Where is rebol fill-pen documented (to get glow effect on a round rectangle)? - rebol

There is some discussion here about fill-pen
http://www.mail-archive.com/rebol-bounce#rebol.com/msg02019.html
But I can't see documentation about cubic, diamond, etc... effect for fill-pen in rebol's official doc ?
I'm trying to draw some round rectangle with glowing effect but don't really understand the parameters I'm playing with so I can't get exactly what I'd like (I'd like the glow effect starting from the center not from the dark left top corner):
view layout [
box 278x185 effect [ ; default box face size is 100x100
draw [
anti-alias on
; information for the next draw element (not required)
line-width 2.5 ; number of pixels in width of the border
pen black ; color of the edge of the next draw element
; fill pen is a little complex:
;fill-pen 10x10 0 90 0 1 1 0.0.0 255.0.0 255.0.255
fill-pen radial 20x20 5 55 5 5 10 0.0.0 55.0.5 55.0.5
; the draw element
box ; another box drawn as an effect
15 ; size of rounding in pixels
0x0 ; upper left corner
278x170 ; lower right corner
]
]
]

Finally I made it so not sure how I did manage to get :)
(source: reboltutorial.com)
view banner: layout/size [
;layout (window client area) size is 278x170 at the end of the spec block
at 0x0 ;put the banner on the top left corner
box 278x170 effect [ ; default box face size is 100x100
draw [
anti-alias on
; information for the next draw element (not required)
line-width 2.5 ; number of pixels in width of the border
pen black ; color of the edge of the next draw element
; fill pen is a little complex:
;fill-pen 10x10 0 90 0 1 1 0.0.0 255.0.0 255.0.255
;fill-pen radial 100x50 5 55 5 5 10 55.0.5 30.10.10 55.0.5
;fill-pen radial 100x50 5 55 5 10 10 55.0.5 30.10.10 71.0.6
fill-pen radial 100x50 5 55 5 10 10 71.0.6 30.10.10 71.0.6
; the draw element
box ; another box drawn as an effect
15 ; size of rounding in pixels
0x0 ; upper left corner
278x170 ; lower right corner
]
]
pad 30x-150
Text "Experiment" font [name: "Impact" size: 24 color: white]
image http://www.rebol.com/graphics/reb-logo.gif
] 278x170

Related

How to prevent labels from being cut off in matplotlib .mplstyle

I've been trying for awhile but I haven't found any rcparams that stop my xlabel from getting cut off at the bottom when doing a savefig(). It works fine if I do fig.subplots_adjust(bottom=0.15) or plt.tight_layout() before savefig(), but I'd rather the default behavior result in a nice plot.
Maybe I have something wonky in my .mplstyle? But is mostly just copy paste from seaborn. I include it below for reference:
# default seaborn aesthetic
# darkgrid + deep palette + notebook context
axes.axisbelow: True
axes.edgecolor: black
axes.facecolor: 333333
axes.grid: True
axes.labelcolor: white
axes.labelsize: 18
axes.linewidth: 0
axes.prop_cycle: cycler('color', ['30bbff', 'ff6b51', 'ffc851', '7de524', 'dbdbdb', 'ff00f3'])
axes.titlesize: 24
figure.facecolor: black
figure.figsize: 8.0, 5.5
savefig.dpi: 80
font.family: sans-serif
font.sans-serif: Arial, Liberation Sans, DejaVu Sans, Bitstream Vera Sans, sans-serif
text.color: white
grid.color: black
grid.linestyle: -
grid.linewidth: 1
image.cmap: Greys
legend.fontsize: 14
legend.frameon: False
legend.numpoints: 1
legend.scatterpoints: 1
lines.linewidth: 2
lines.markeredgewidth: 0
lines.markersize: 7
lines.solid_capstyle: round
patch.facecolor: 4C72B0
patch.linewidth: .3
xtick.color: white
xtick.direction: out
xtick.labelsize: 16
xtick.major.pad: 7
xtick.major.size: 0
xtick.major.width: 1
xtick.minor.size: 0
xtick.minor.width: .5
ytick.color: white
ytick.direction: out
ytick.labelsize: 16
ytick.major.pad: 7
ytick.major.size: 0
ytick.major.width: 1
ytick.minor.size: 0
ytick.minor.width: .5
Since your labels are somewhat larger than usual, you indeed need to leave more space at the bottom.
Instead of the default figure.subplot.bottom : 0.11 for the bottom you may use
figure.subplot.bottom : 0.15
This should work if fig.subplots_adjust(bottom=0.15) works for you. Otherwise increase the number further.

How to draw a square in GrADS?

I am looking for a command line that allows to draw a square in my plot in GrADS. Here is an example
I would like to get a command line which allows me to draw a square like the one that I show on my picture example.
I assume the boundaries of the square you want to draw are based on lat/lon coordinates, and the bottom left corner is at (4N, 74W) and the upper right corner is at (8N, 72W). The following script fragment should work, but you must draw the plot first in order to set up the scaling between world coordinates and X,Y location on the page.
'q w2xy -74 4'
xpos1=subwrd(result,3)
ypos1=subwrd(result,6)
'q w2xy -72 8'
xpos2=subwrd(result,3)
ypos2=subwrd(result,6)
'set line 2 1 6' '* a thick, red line
'draw rec 'xpos1' 'ypos1' 'xpos2' 'ypos2
This is what it looks like if you are working with GrADS interactively:
ga-> q w2xy -74 4
X = 4.77083 Y = 3.08333
ga-> q w2xy -72 8
X = 5.74306 Y = 5.41667
ga-> set line 2 1 6
SET LINE values: color = 2 style = 1 thickness = 6
ga-> draw rec 4.77083 3.08333 5.74306 5.41667

AQGridView: no padding on outside, only inside

I have a 768px-wide grid view, with cells that are 240 wide. This means that I get 3 columns, with 8 pixels of padding on the left and right of each. This is similar to this situation: AQGridView: How to adjust UIGridViewCell margin.
Instead of evening out the padding, I want the padding to be only in the "middle", not on the outside of the outer columns.
So:
[ [cell] [24 pixels of padding] [cell] [24 pixels of padding] [cell] ]
Is this possible?

How to Calculate Leading in PDF Document

How do I calculate leading in a PDF document?
For example:
48 0 0 48 72 677.28 Tm
(Hello World) Tj
0 -1.1075 TD
This renders the text Hello World at 48pt/57.6pt (120% line height) in Times-Roman.
According to the PDF Reference manual, "the leading parameter is measured in unscaled text space units. It specifies the vertical distance between the baselines of adjacent lines of text... The number is expressed in thousandths of a unit of text space."
Can someone please explain how 1.1075 and 57.6 are related?
You pdf commands is incorrect. I suppose you mean:
48 0 0 48 72 677.28 Tm
0 -1.1075 TD
(Hello World) Tj
This code set text coordinate system to (Tm command):
Scale x48 on x and x48 on y
Start position (72, 677.28)
Then it's move position to next line. Next line in 1.1075 "text" pixels. And then move start position by -1.1075 "text" pixels on y coordinate. Text pixel in this example it's pdf pixel multiplyed by 48. It's set by Tm command.
I may simplify you PDF code. It's the same:
48 0 0 48 72 570.096 Tm
(Hello World) Tj
Explanation: 677.28 - (1.1075*48) - (1.1075*48)
YOU should always remember that PDF it's a language. To calculate the real coordinates you shoud parse all previous commands.
There may be something like this before you commands:
10 0 0 10 0 0 cm
The leading is usually set in the PDF by the command TL, just like this:
12 TL
(El ingenioso hidalgo don Quijote de la Mancha)'
That 12 indicates a leading of 12 points until another TL is found.
I hope it helps you. I think this is the easiest way to do it :)

GNUPLOT: dot plot with data depending dot size

I am trying plot data sets consisting of 3 coordinates:
X-coordinate, x-coordinate and the number of occurrences.
example:
1 2 10
3 1 2
3 2 1
I would like to draw for every line a dot at x,y with a diameter which is depending on the third value.
Is that possible with Gnuplot?
Create a 2D plot with variable point size. See the demo.
Example:
plot 'dataFile.dat' u 1:2:3 w points lt 1 pt 10 ps variable
This is basically equivalent to the existing answer, just shorter:
plot 'dataFile.dat' with circles
Credit: Gnuplot: plot with circles of a defined radius