Scilab Figure Background Color - colors

I have recently started to use Scilab, and in general it works as a good replacement for MATLAB.
One of the things that bothers me though is the figure background color. The first background color of a subplot is always grey, the next ones are white. I can change the white ones with figure options, or with the axle handles, but this does not seem to work for the first subplot of each figure. Is this a bug or am I doing something wrong?
(example code is nothing special:)
x=0:10
y=x
figure
subplot(3,1,1)
plot(x,y)
subplot(3,1,2)
plot(x,y)
subplot(3,1,3)
plot(x,y)
Example Picture

That seems to be an issue with figure. You'd better use scf(), which is "set current figure":
scf(); //always creates new figure
scf(n); //if window 'n' doesn't exist, it creates it
//if it exists, it selects it
I myself always use scf() together with clf(), which is "clear figure". Try the code below, it should work fine:
x=0:10
y=x
scf(0); clf();
subplot(3,1,1)
plot(x,y)
subplot(3,1,2)
plot(x,y)
subplot(3,1,3)
plot(x,y)

Related

Getting rid of border on tkinter label

In my most recent posting, the code does exactly what I need it do...is there a way to get rid of the border/lighter gray area around the label? I want to only see the text.
Splitting tkinter canvas and frame apart
I have tried changing the label code to
v = Label(s, bg='gray',fg='black',borderwidth=0,highlightthickness=0,highlightcolor='gray',relief='sunken',anchor='w')
This still leaves the side borders that can be plainly seen in the code at the above link. I just inserted relief cause I saw someone else's post using it and thought I would give it a try versus leaving the relief flat as set by default. Made no difference.
How do I get rid of the light gray sides that are appearing on the Label. I know this is about to really become important probably as soon as this evening or tomorrow morning.

Anyone know if its possible draw to erase the picture on the top?

Scratch allows selection of the color using the set pen color. Does anyone know if its possible to program to set the color to transparent so that what ever is drawn can effectively be erased? What would the color number be for that?
Update
The idea was to cover a picture (background) with a colour drawn over the top. Now give the player a little creature that erases the colour on top, they have a certain amount of moves or time to guess what the picture is. The less moves/time they use the more points the player will be awarded.
But the problem seems to be that in the paint a sprite part of scratch erase is an option, but not in the pen programming.
If I cant solve it using erase apprach, my alternative is to make a lot of sprites covering the picture and hide them when the creature touches them. But it seems less fun for the player as the uncovered patterns will be more predictable.
Unfortunately, this isn't really possible. If you have a backdrop that's all one color, you could set the pen color to be the same as the backdrop and color over what you already have (giving the illusion of erasing), but other than that there really isn't a good way.
Your only other option is to use the clear block and then re-draw everything except the piece you want to erase.
If you want to give more context about your specific project, I might be able to help you work out a solution (I've done quite a lot with pen blocks over the years).
Like PullJosh said, it isn't really possible but you can make a sprite called Cover and make it a circle of any color you want. Then, it can clone it's sprite over the sprite you want to hide. Then you can attach a script to the clones:
https://i.stack.imgur.com/S6h4c.png (ctrl + click)

renderer.material.color giving strange results

I have a weird problem, that i can't figure out.
I want to change a gameobjects base color via renderer.material.color.
But for whatever reason, this only works for some colors.
This is my code:
first, I declare the colors:
var color_movement_available = Color(0.17,0.68,0.05,1);
var color_movement_available_hover = Color(0.33,1.00,0.17,1);
then i assign them, like this
case ("movement_available") :
renderer.material.color = color_movement_available;
break;
case ("movement_available_hover") :
renderer.material.color = color_movement_available_hover;
break;
However, when I test the script, the hovering color (pinkish) will not show.
I checked in the inspector and the color is the one i aimed for and is correctly switched.
When i change it to a bright (basecolor) green, red, blue or yellow, it works as supposed.
Other colors will produce white and some wont change anything.
Has anyone an idea what's causing this effect, or better yet, how to solve it?
What i tried so far:
switching the material renderer to diffuse (from transparent/diffuse):
same results
changing the materials initial basecolor to grey (from white):
also, no change
Maybe this has something to do with the way colors are applied ...
cheers
Edit: Screenshots:
Also, apparently, colors that are close to each other, like the same color only darker/lighter appear to be the ones producing white
I'm guessing you have a mesh renderer on your object.
Try GetComponent< MeshRenderer >().material.color

Drawing ruled lines in UITextView

In a UITextView I want to draw ruled lines along with the text. For that, I subclass UITextView and overwrite drawRect. Seing a few post on the subject (including on this site), that seems the right way to start.
Here is the loop where I draw the lines:
for (int x=1;x<numberOfLines;x++) {
yPos=self.font.lineHeight*x+baselineOffset;
CGContextMoveToPoint(context,self.bounds.origin.x,yPos);
CGContextAddLineToPoint(context,self.bounds.size.width,yPos);
}
baselineOffset in this code is constant, meaning I step by self.font.lineHeight
but seeing the picture below (with the slow shifting between the lines and the text) I am obviously not using the right value for incrementing
the y coordinate (here called yPos). What should I use?
Has anyone got an idea of what could be the problem?
Thank you for any tip.
Use font.leading instead of font.lineHeight.

OCR: How to find the right ColorMatrix to define new colors?

I'm stuck right now with defining the dimension of each line. The list I want to scrape has various colors in it, and what disturbs me the most a selection:
As you can see the picture I try to analyze got a white background with green text. The selection background is grey with black text. And every second line has a slightly greyer background, but I managed to manipulate the contrast with a ColorMatrix.
Just for reference, I do have some other ColorMatrizes like Greyscale, Negative, SetContrast, SetBrightness and so on.
My method, which is searching the lines does work good with the most part of the picture, but the selection brakes it.
So now I'm stuck and don't know what to do. I googled for an hour, but didn't find a solution.
I thought, that maybe I can transform the background grey from the selection to white without affecting the text and greyscale the rest of the picture. But I can't find a ColorMatrix which does the job.
Do you know one or got a better solution?
Why use a color-matrix at all?
It works (at least for your specific example) much easier with ImageMagick's -threshold operation:
convert \
http://img18.imageshack.us/img18/210/lobbymd9.jpg \
-threshold 50% \
result.jpg
Visual Result:
=>
Thresholding basically leaves over only 2 values (zero or maximum) for each color. Every value below the threshold gets set to 0, values above the threshold get set to 255 (or 65535 if working at 16-bit depth). The end effect is a pure black+white picture.

Resources