Swift charts framework - mark/highlight regions of LineChart? - swift

I am wondering if anyone knows of an elegant way to mark and highlight parts of a LineChart.
This could be done in a variety of ways, for example:
A. Using a dashed line "marked" regions of the graph
B. Shading the region underneath "marked" regions of the graph
ex: Filled Area Example
C. Using two distinct markers to distinguish the beginning and end of a "marked" region of the graph
The process of "marking" does not have to be touch-based - programmatic is OK too.
Any suggestions on implementation would be appreciated...thanks!

Related

Some way to outline labeled regions separately?

I have processed an image to the point where I have certain labelled regions. Shown here with each labelled region in different shade.
I would like to show the outline of each region separately. Currently I am using bwmorph(labeledImage,'remove') but this treats any regions contacting each other and keeps the outlines of the conjunction of the multiple regions.
I am looking for a function that will keep all the outline / edge pixels for each region, something that would result in an image like the following (green edges added to show what is missing from the method I am already using).
You can differentiate all regions, so why dont you treat them separatly?
See this bwboundaries.

How to visualize correlation matrix as a schemaball in Matlab

I have 42 variables and I have calculated the correlation matrix for them in Matlab. Now I would like to visualize it with a schemaball. Does anyone have any suggestions / experiences how this could be done in Matlab? The following pictures will explain my point better:
In the pictures each parabola between variables would mean the strength of correlation between them. The thicker the line is, the more correlation. I prefer the style of picture 1 more than the style in picture 2 where I have used different colors to highlight the strength of correlation.
Kinda finished I guess.. code can be found here at github.
Documentation is included in the file.
The yellow/magenta color (for positive/negative correlation) is configurable, as well as the fontsize of the labels and the angles at which the labels are plotted, so you can get fancy if you want and not distribute them evenly along the perimeter/group some/...
If you want to actually print these graphs or use them outside matlab, I suggest using vector formats (eg eps). It's also annoying that the text resizes when you zoom in/out, but I don't know of any way to fix that without hacking the zoom function :/
schemaball % demo
schemaball(arrayfun(#num2str,1:10,'uni',false), rand(10).^8,11,[0.1587 0.8750],[0.8333 1],2*pi*sin(linspace(0,pi/2-pi/20,10)))
schemaball(arrayfun(#num2str,1:50,'uni',false), rand(50).^50,9)
I finished and submitted my version to the FEX: schemaball and will update the link asap.
There are a some differences with Gunther Struyf's contribution:
You can return the handles to the graphic object for full manual customization
Labels are oriented to allow maximum left-to-rigth readability
The figure stretches to fit labels in, leaving the axes unchanged
Syntax requires only correlations matrix (but allows optional inputs)
Optimized for performance.
Follow examples of demo, custom labels and creative customization.
Note: the first figure was exported with saveas(), all others with export_fig.
schemaball
x = rand(10).^3;
x(:,3) = 1.3*mean(x,2);
schemaball(x, {'Hi','how','is','your','day?', 'Do','you','like','schemaballs?','NO!!'})
h = schemaball;
set(h.l(~isnan(h.l)), 'LineWidth',1.2)
set(h.s, 'MarkerEdgeColor','red','LineWidth',2,'SizeData',100)
set(h.t, 'EdgeColor','white','LineWidth',1)
The default colormap:
To improve on screen rendering you can launch MATLAB with the experimental -hgVersion 2 switch which produces anti/aliased graphics by default now (source: HG2 update | Undocumented Matlab). However, if you try to save the figure, the file will have the usual old anti-aliased rendering, so here's a printscreen image of Gunther's schemaball:
Important update:
You can do this in Matlab now with the FileExchange submission:
http://www.mathworks.com/matlabcentral/fileexchange/48576-circulargraph
There is an exmample by Matlab in here:
http://uk.mathworks.com/examples/matlab/3859-circular-graph-examples
Which gives this kind of beautiful plots:
Coincidentally, Cleve Moler (MathWorks Chief Mathematician) showed an example of just this sort of plot on his most recent blog post (not nearly as beautiful as the ones in your example, and the connecting lines are straight rather than parabolic, but it looks functional). Unfortunately he didn't include the code directly, but if you leave him a comment on the post he's usually very willing to share things.
What might be even nicer for you is that he also applies (and this time includes) code to permute the rows/columns of the array in order to maximize the spatial proximity of highly connected nodes, rather than randomly ordering them around the circumference. You end up with a 'crescent'-shaped envelope of connecting lines, with the thick bit of the crescent representing the most highly connected nodes.
Unfortunately however, I suspect that if you need to enhance his code to get the very narrow, high-resolution lines in your example plots, then MATLAB's currently non-anti-aliased graphics aren't quite up to it yet.
I've recently been experimenting with MATLAB data and the D3 visualization library for similar graphs - there are several related types of circular visualizations you may be interested in and many of them are interactive. Another helpful, well-baked, and freely available option is Circos which is probably responsible for most of the prettier versions of these graphs you've seen in popular press.

MultiLine Graph in CorePlot

I want to Draw multiple line Graph with each line have different color and different Data in Graph.
I show "CPTTestApp-iPad" an Example from Core plot 1.0 Examples folder. I plot single line chat but Still i dont clear all the thing.
Please can any one guide me to How to developing multi line chart? Any learning tutorial for multi line chart graph and beginner of core plot ?
A Core Plot graph can have as many plots as you want and they can be different types, too. Assign a unique identifier to each plot and use that in your datasource to determine what values to return.

Highlight a single plot symbol on a line - Core Plot

I'm making an iPhone app that uses Core Plot at one point in the application. I'm drawing a graph using a CPTScatterPlot and along the line I have CPTPlotSymbol plot symbols.
the graph is looking really good after some customizing but what I want to do is give the user a bit better visual representation of where exactly on the graph the current material is referring to.
I would like to "highlight" individual plot symbols along my line. I have the location on the xAxis of the point I want to manipulate. I have not been able to find any example of this or even a suggestion that it's possible, it seems to be possible for pie charts and bar plots though.
If it is not possible to change or manipulate the actual plot symbol at a point I'm quite happy to simply draw something over the symbol. If so, is there a way to get the x,y coordinates (in relation to the screen) of each plot symbol? Or will I have to calculate that from my data? My data varies a_lot so I'm simply auto resizing the plot area at the moment.
thanks!
You can implement the -symbolForScatterPlot:recordIndex: datasource method to customize the plot symbol at each point. Return nil if you don't want a symbol drawn at the given index. The Mac version of CPTTestApp (in the Core Plot examples folder) has a plot symbol demo that shows how to use this method.

Graph Formatting Tools For Octave

I know that Matlab allows for you to format the graph after its created through the interface. However there isn't the same features in Octave. Is there a tool that goes between Octave and GnuPlot? If there isn't such a tool, is there a tool that will generate the formatting options?
I've heard of EasyPlot, but it isn't free.
I've discovered there are some formatting options on the GNU Plot graph after it has been generated through octave. If you press 'm' it's then possible to right click and get a menu with choices to format the plot (line styles/colour/background/print). However, for me it crashes a lot and changing the values doesn't seem to have much effect.
There is some other functionality by using these key presses..
m - allow menu on right-click
a - zoom to full window
p - previous zoom level
r - overlay ruler
g - overlay grid
b - toggle border
1 - toggle output reading format
5 - display radius measure tool (when ruler is displayed)
7 - format aspect ratio (useful to get square plots to not distort scale)
These are just the ones I've found by randomly testing the keyboard (!), so this is hardly exhaustive. But hope that helps.
I've used GNU plot in the past for some visualizations. I didn't find any front end interface to set things like colors or labels but it was easy enough to set some basic things on the command line. This site helped me out: http://t16web.lanl.gov/Kawano/gnuplot/intro/plotcalc-e.html
Octave uses Gnuplot as the default plotting backend, though it supports other options. It also supports most of the graph functions that Matlab does, including ones that change the plot after it was created.