I want in the the left frame of the calendar (where the hours are shown) to put some letters or titles.
For instance A1, A2, A3 etc.
in calendarview.js
axisFormat: userDefaultTimeFormat,
and
var userDefaultTimeFormat = jQuery('#time_format').val();
if(userDefaultTimeFormat == 24){
userDefaultTimeFormat = 'H(:mm)';
} else {
userDefaultTimeFormat = 'h(:mm)tt';
}
I have changed
userDefaultTimeFormat = 'H(:mm)';
to
userDefaultTimeFormat = 'A1 H(:mm)';
This only changes the first quarter..
I want the same o the remaining quarters
(9.15) A2, (9.30) A3, (9.45) A4. (Only the characters no time)
How can i do that?
Related
I am using substitution labels (##) with diagrammeR and Graphviz syntax. I have seen previous questions about justification of node labels such as this one when the labels are in-line text, but I am wondering how to justify node text generated from a multi-row substitution label. More specifically, for the label in the reproducible example below, I want the ‘main’ column, meaning the first and third rectangle labels, to remain centered, but multi-line node labels such as the rightmost rectangle to be left justified (the value as well as the subvalues). Since I specify line breaks in the substitution labels, I tried using double backslash \l instead of \n without success.
Additionally, I would like to bold the headers (in the reproducible example, the first value, second value, and third value rows), but not bold any subvalues.
Any help would be greatly appreciated. Thank you!
library(DiagrammeR)
library(DiagrammeRsvg)
a <- 100
x <- 50
b <- 30
d <- 20
grViz("
digraph a_nice_graph {
node[fontname = Helvetica, shape = box, width = 4, fontcolor = darkslategray]
firstvalue[label = '##1']
secondvalue[label = '##2']
thirdvalue[label = '##3']
blank[label = '', width = 0.01, height = 0.01]
{ rank = same; blank secondvalue }
firstvalue -> blank [dir = none]
blank -> secondvalue[minlen = 9]
blank -> thirdvalue
}
[1]: paste0('First value (n = ', a, ')')
[2]: paste0('Second value (n = ', a-x, ')\\nSubvalue = ', b, '\\nSubvalue = ', d, '')
[3]: paste0('Third value (n = ', x, ')')
")
I'm trying to subplot my data, but printing in PDF brings results I can't use: Title and x-axis title are cut (and the legend's box is covered by the graph, but I can handle this with other positions). I have to use gnuplot and pdfcairo because other seup isn't working with special characters, umlaut, etc.
clear;clc;close all;clf;clear all;
graphics_toolkit("gnuplot")
x = 0:.1:10;
y1 = exp(-x).*sin(x);
y2 = exp(x);
h=figure(1);
subplot(2,1,1);
plot(x,y1)
h1 = plot(x,y1);
set(h1,'LineWidth',4)
set(gca,'FontSize',32)
set(gca,'FontName','Times')
set(get(gca,'Ylabel'),'String','TTEST test \rho \rightarrow','FontWeight','Bold','FontSize',32)
set(get(gca,'Xlabel'),'String','abc / - \rightarrow','FontWeight','Bold','FontSize',32)
legend({
'h_{ref}(t)'
},"location", 'northeast');
title('TITLE')
l1 = legend;
set(l1,'FontName','Times')
subplot(2,1,2);
h2 = plot(x,y2);
set(h2,'LineWidth',4)
set(gca,'FontSize',32)
set(gca,'FontName','Times')
set(get(gca,'Ylabel'),'String','TTEST test \rho \rightarrow','FontWeight','Bold','FontSize',32)
set(get(gca,'Xlabel'),'String','agc / -\rightarrow','FontWeight','Bold','FontSize',32)
legend({
'h_{ref}(t)'
},"location", 'northeast');
l2 = legend;
set(l2,'FontName','Times')
print ('title_axis.pdf', '-dpdfcairo', '-S1000,600');
clc
x = [1:1:10];
y1 = x;
y2 = 2*x;
y3 = 3*x;
plot2d(x,y1);
plot2d(x,y2);
plot2d(x,y3)
gca().children(1).children(1).thickness = 2
gca().children(2).children(1).thickness = 7
gca().children(3).children(1).thickness = 4
I am new from Matlab to Scilab
Could someone tell me, how to unterstand children?
What means
gca().children ?
gca().children.children ?
gca().children.children(1) ?
gca().children(1).children ?
How can we know which attribute belong to children ?
e.g gca().children(1).children(1).color = ... // not exist
I am very confused now.. Thanks in Advance
Let's schematize the nested graphical object by their children properties.
We have
figure (f)
- axes (a)
- compound1 (c1)
- polyline (p1)
- compound2 (c2)
- polyline (p2)
- compound3 (c3)
- polyline (p3)
Since gca is a function lets do a = gca() because gca().children will raise an error because scilab doesn't understand that you're trying to access to the fields of its return value.
gca() returns the handles to the axes of the current figure :a.
a.children returns the array of handles of all the children of theses axes. : c1, c2, c3
a.children.children returns the array of handles of all the children of the above objects: p1, p2, p3
a.children.children(1) returns the first children of c1, c2, c3 : p1
a.children(1).children returns all the children of the first children of the current axes (c1). Since there only one : p1
To access the value of your entities
Either go for a temp variable :
a = gca();
idcolor=a.children(1).children(1).foreground // gives the color of a.c1.p1
or use get
// idcolor is an array , with idcolor(i) the color of pi
idcolor = get(get(get(gca(),'children'),'children'),'foreground')
FYI
gce() command returns the handle of the last object created. With plot2d its a compound so we need to get its children.
you could rewrite your program as
clc
x = [1:1:10];
y1 = x;
y2 = 2*x;
y3 = 3*x;
plot2d(x,y1);
e1 = get(gce(),'children');
plot2d(x,y2);
e2 = get(gce(),'children');
plot2d(x,y3)
e3 = get(gce(),'children');
e1.thickness = 2
e2.thickness = 7
e3.thickness = 4
I want to use the data of [x] to fill in [test] based on certain sequence:
x = matrix(rnorm(330),165,2)
origins = 130:157
horizon = 8
col = 1:2
test = array(0, c(length(origins)*length(col), horizon))
for( origin in origins){
for (c in col){
test[which(origin==origins), ] = x[(origin+1):(origin+8), c]
}
}
However, this code only helps extract the second column of [x] to fill in the first 28 rows of [test]. The following picture is only a part of a complete [test] table, showing the ineffective filling from row 29 to row 56.
enter image description here
Anyone who can help me fill in them completely? Thank you very much.
Here is a possible solution, but it is still not clear what you want the result to be. better to make much smaller data and show desired result.
The left hand side of the assignment, in the original code, does not vary with c, so each time through the loop for c the same rows of test will be overwrittem,
x = matrix(rnorm(330),165,2)
origins = 130:157
horizon = 8
col = 1:2
test = array(0, c(length(origins)*length(col), horizon))
for( origin in origins){
for (c in col){
# the left hand side must vary somehow with c as well.
test[(which(origin==origins)-1) + (c - 1) * length(origins) + 1, ] = x[(origin+1):(origin+8), c]
}
}
I have an MxNx2 array of 2D points, where each point represents the center of a measured property of a grid. The graphical representation is below, with white points being the positions:
The point structure is like this (shape: MxNx2):
[[[xij, yij], [xij, yij], ...]],
[[xij, yij], [xij, yij], ...]],
[[xij, yij], [xij, yij], ...]],
[ ..., ...., ............... ],
[[xij, yij], [xij, yij], ...]]]
The desired output would be like this:
[[[x1, x2], [y1, y2]],
[[x1, x2], [y1, y2]],
....................,
[[x1, x2], [y1, y2]]
So that I could plot every segment one by one (using each pair of x,y positions) like this:
I have trying something similar to:
segments = []
for row in xrange(a.shape[0] - 1):
for col in xrange(a.shape[1] - 1):
here = a[row, col]
below = a[row+1, col]
right = a[row, col+1]
segments.extend(((here, right), (here, below)))
but that leaves the right and bottom edges uncovered. Also, I suspect this is a somewhat "dumb", non-vectorized, brute-force way of doing it, it seems to be a common enough problem to have perhaps a mesh-creating function for it.
Any suggestion is welcome!
It can be done by adding segments separately for axis:
for row in xrange(a.shape[0]):
segments.extend( (a[row, col], a[row, col+1]) for col in xrange(a.shape[1] - 1) )
for col in xrange(a.shape[1]):
segments.extend( (a[row, col], a[row+1, col]) for row in xrange(a.shape[0] - 1) )
Or with zip():
s1 = (a.shape[0]*(a.shape[1]-1), 2)
s2 = (a.shape[1]*(a.shape[0]-1), 2)
segments = list(zip( a[:,:-1].reshape(s1), a[:,1:].reshape(s1))) + \
list(zip( a[:-1,:].reshape(s2), a[1:,:].reshape(s2)))
In case someone is interested, I modified the code I was using and it now works, perhaps not so elegantly or eficiently, but...
pairs = []
for row in xrange(pointarray.shape[0]):
for col in xrange(pointarray.shape[1]):
here = pointarray[row, col]
if row < pointarray.shape[0]-1:
below = pointarray[row+1, col]
pairs.append((here, below))
if col < pointarray.shape[1]-1:
right = pointarray[row, col+1]
pairs.append((here, right))