How to draw a soft line in gdi/gdi+ - gdi+

soft line means, the line will draw some interim color around.

GDI can't do this. For GDI+ see this Microsoft article: http://msdn.microsoft.com/en-us/library/ms536351(VS.85).aspx
To turn on line smoothing use
myGraphics.SetSmoothingMode(SmoothingModeAntiAlias);

Related

Putting a best fit line through a binscatter in ggplot2

Piggy backing off of this great thread, I am hoping to introduce a best fit line through the orange lines from robust's answer. I understand that I can connect the lines by adding another stat_summary_bin with geom = "line", but this generates a line that goes through each point, and I am looking for a best fit line through these points, if this is even possible.
Thanks!
You can use binsreg to do this: https://nppackages.github.io/binsreg/. binsreg can plot the best fit line or other parametric fits.

Name for special type of wheel graph

Is there a name for this graph? It would be a wheel graph, except that alternate bounding edges have been removed (similar to the "radioactivity" warning symbol):
special wheel
Thanks!
I found the answer: it's a windmill graph:
https://en.wikipedia.org/wiki/Windmill_graph
According to that page, it is actually a special type of windmill known as a "friendship graph".

3D Line Plot with Datavisualization

I am looking for a way to draw a 3d line plot. Preferably I would like to use the datavisualization framework, but it does not seem to provide this out of the box.
I experimented a little bit and ended up using 3D surface plots (Surface3D) displaying the lines as surfaces (i.e. ribbons) like this:
While this works and looks okay in above picture the thickness of the line depends on the perspective. Rotating the plot always allows to find the angle where the line disappears since it has not thickness:
Is there a type of plot that would be better suited for this? I tested the bars which don't perform well for lots of samples and don't look nice in my application. I also tested scatterplots which are not suitable either.
If there isn't: Where would I start to implement this myself on top of the existing classes in the datavisualization framework? I am thinking about adding another surface "ribbon" in z direction, however that seems a little hackish.
I used the technique described as hackish above. While I am not too happy about the approach the overall look is quite okay:
So basically each data line consists of three QSurfaceDataRows that together form two 90° ribbons as can be seen here:

ggplot: Pallete Greyscale On Print, Colourful on Screen [duplicate]

I've started to produce the charts for a paper. For some of them which are bar charts I've used the "Pastel1" palette (as recommended in the book on ggplot2, pastel colours are better than saturated ones for fill areas, such as bars).
The problem with Pastel1 at least is that when printed on a B&W laser printer, the colours are indistinguishable. I don't know if the readers will view the paper on screen or will print it on B&W, so I'm looking for either of the following:
how to add hash lines to a palette such as Pastel1 (hopefully the hash lines are also subtle)
a colour palette easy on the eyes that also produces distinct grey areas for B&W for, say, up to 3-4 different colours.
Granted, I could find the latter by experimenting and using toner, but perhaps this has already been solved, I suppose it's a common problem. And yes, I did google for this, but didn't find anything pertinent.
Thank you.
Use http://colorbrewer2.org/ and only show colour schemes that are printer friendly.
Also see scale_fill_grey.
Currently it's not possible to used hash lines due to a limitation in the underlying grid drawing package.
There is the col2grey function in the TeachingDemos package that will convert a set of colors to an approximation of the grey color that will result from printing. You can use this to try different pallettes without wasting toner/paper.
Use this to select another color combination (gray scale option included)

How to make dashed / dotted / dash-dotted line in octave?

I'd like to create monochrome diagram/graph in octave using plot command.
That is why I'd like make different lines of graphs with using line style, for example dashed/dotted/dash-dotted styles. Standard plot suggests several styles for line, but none of them looks like listed variants.
EDIT-1:
Standard plot styles are inapplicable for my case: such styles as ":", "-.", "--" don't work, octave draws solid lines in any case. Furthermore, diamonds and squares (d and s options) are ugly and disproportionate big. May be it will be helpful information: I'm using Octave under Windows.
EDIT-2: For example, such command plot(A(:,1),A(:,2),"-.dk") gives me such (inapplicable !!!) figure
More specifically I want something like this (in part of line style)
(Picture from article: McCallum and K. Nigam. 1998. A comparison of event models for Naive Bayes text classification. In Proceedings of AAAI-98 Workshop on Learning for Text Categorization)
These can be set with the FMT argument of plot. Basically, these seem to be your options (see the manual entrey on line styles):
"-" solid lines
":" points
"-."dash followed by dot
"--" dashed
"none" no line (only markers)
There is also the option "." for dots but this is for the actual data points, not the line. So to recreate your picture, something like the following should work
plot (multinominal, "-dk", "MarkerFaceColor", "k")
hold on;
plot (mv-bernoulli, ":sk", "MarkerFaceColor", "k")
The syntax may look a bit strange but here's how to read it. For -dk, - is for solid line, d for diamond shaped marker, and k for black colour (b would be for blue). On :sk, it's dotted line and square shaped marker in black colour.
See the section on the manual for advanced plotting.
EDIT: see the comments below. This may not work in very old versions of Octave.
Well, I found a simple solution by myself (using Google ;))
For gaining monochrome diagram/graph with a different style of lines in Octave, we don't need to use plot's styles like "--" or "-." (because they do not work).
Just one thing we need is the command print. Monochrome figures can be created for example in the eps format:
print -deps "diagram.eps"
This gives me quite a nice picture:
I had the same problem and I think that the solution to make visible the line style is changing the linewidth. Many linestyles are not distinguished when the default linewidth value is used (which is 1).
Try the following code and see if it works:
x = ( 0:0.4:10 );
f = sin(x) .* exp(-4 .* x);
g = sin(x);
plot(x,f,'r:','linewidth',5,x,g,'-.','linewidth',2)
print(gcf,"PlotSimple.pdf")

Resources