I am trying to make images with Graphviz that will illustrate some process that involves adding a few edges to an existing graph. It is crucial that the vertices and edges of the base graph remain in place.
I've tried to add my new edges with [constraint=false] but keep getting different layouts for the base and the new graph, wherever I add more than one edge. Another method I tried with little to show for it was running dot for the graph with all the extra edges and then manually removing the extra lines - still no dice.
The graph I am trying to draw is this:
graph G{
overlap=scale;
node [weight=.2,height=.1];
edge [len=2.1];
3--2 [constraint=false];
4--1 [constraint=false];
5--3 [constraint=false];
6--1 ;
6--2 ;
6--3 ;
6--4 ;
6--5 ;
7--1 ;
7--2 ;
7--3 ;
7--4 ;
7--5 ;
8--1 ;
8--2 ;
8--3 ;
8--4 ;
8--5 ;
}
Any help will be greatly appreciated.
I think you can try with :
3--2 [style="invis"];
4--1 [style="invis"];
5--3 [style="invis"];
and then :
3--2 [style="bold"];
4--1 [style="bold"];
5--3 [style="bold"];
to show - and emphasis - the new edges.
The nodes and edges that are invis are not shown but still used to compute the layout.
Instead of Graphviz, there are many GUI graph analysis tools that let you run layout algorithms and position things manually. You can fix node positions, and even color or change the width the added edges to make them stand out. These tasks are trivial in NodeXL (C#), a great open source tool that integrates network analysis into Excel 2007/2010 (Disclaimer: I'm an advisor for it).
Here is your graph visualized in NodeXL, and another image with the new edges colored red.
To create the second image, just open up the 'Edges' worksheet in NodeXL and paste in your data in the first three columns like this:
3 2 red
4 1 red
5 3 red
6 1
6 2
6 3
6 4
6 5
7 1
7 2
7 3
7 4
7 5
8 1
8 2
8 3
8 4
8 5
You can download the graphml file here, which includes your data and the node coordinates that you could import into NodeXL.
There are tons of other open source GUI tools to visualize graphs, like Gephi (Java) and Cytoscape (Java), while Pajek, UCINet, yEd and Tom Sawyer are some proprietary alternatives.
Related
I have a simple fdp graph laid out in graphviz, with a bunch of nodes (rectangle and diamond shaped) having fixed positions, and some of those nodes have child nodes (oval shaped) that I want to be arranged around them automatically.
I want all edges in it to be straight, with no curves or polylines or anything (i.e. as given by splines=false), but I also want those child nodes to not overlap with edges between nodes with fixed positions. The fixed positions are used as I need edges between the fixed nodes to be fully vertical or horizontal. This is something that I probably can achieve by iterating over different start values and hoping that the next one will not have overlaps, but so far this is a bit tiresome.
digraph G {
###GRAPH
layout=fdp
overlap=false
dpi=150
splines=false
inputscale=0.4
# fdp specific:
K=0.50
maxiter=2000
start=1251
###OBJECTS
node[shape=rectangle width=1.0 height=0.4 fixedsize=true]
vendor[label="Поставщик" pos="3,1!"
]
item[label="Товар" pos="0,2!"
]
post[label="Поставка" pos="2,2!"
]
check[label="Чек" pos="1,1!"
]
prod[label="Продажа" pos="0,0!"
]
###SUBOBJECTS
node[shape=oval width=1.5 height=0.5]
edge[arrowhead=none]
{
vendork[label=<<u>ID поставщика</u>>] "Название\nпоставщика" "Контакт\nдля связи"
}->vendor
{
itemk[label=<<u>ID товара</u>>]
Название Тип Подтип Характеристики "Розничная цена"
}->item
{
postk[label=<<u>ID записи</u>>] post1[label="ID товара"]
post2[label="Кол-во"] post3[label="Цена поставки"]
post4[label="Дата"] post5[label="Квитанция"]
}->post
{
prodk[label=<<u>ID продажи</u>>] prod1[label="ID товара"]
prod2[label="Кол-во"] prod3[label="Цена\nпродажи"]
prod4[label="Чек"]
}->prod
{
checkk[label=<<u>ID чека</u>>] Дата Кассир "Сумма" "НДС" "Итого" "Вид оплаты"
}->check
###CONNECTIONS
node[shape=diamond]
edge[arrowhead=open]
vendorpost[label="Поставляет" pos="3,2!"
]
vendorpost->vendor
vendorpost->post[arrowhead=openopen]
postitem[label="Поставлен" pos="1,2!"
]
postitem->item
postitem->post[arrowhead=openopen]
itemprod[label="Продан" pos="0,1!"
]
itemprod->item
itemprod->prod[arrowhead=openopen]
prodcheck[label="Включает" pos="1,0!"
]
prodcheck->prod[arrowhead=openopen]
prodcheck->check
}
(forgive the cyrillics)
I am compiling with no additional parameters (i.e. dot -Tpng graph.gv > graph.png). So far, I get this.
I've tried using neato instead as well, but, in most cases, it gives a pretty weird result, where it seems like it completely ignores the fixed node positions, and draws the child nodes whereever it wants:
I went through the list of attributes in the documentation, and so far none seem to address node/edge overlapping besides splines (unless I've missed something). What should I do to achieve the result I'm looking for?
There are several issues:
layout=fdp causes the fdp layout engine to be used, no matter what the command line says
Use neato -n if you want to nail down the node position (see below)
by adding a ! to the position you are nailing down the pos (it won't change)
dot is not useful here, it is directional (top-down)
If you remove all the !, I think you will get what you want.
So far, one solution I've found is by adding invisible stretched out nodes that cover each edge that is fixed(i.e. between two nodes with fixed positions) by appending this to the graph:
###NO VERTICAL/HORIZONTAL EDGE/NODE INTERSECT HACK
node[style=invis]
node[width=0.1 height=2.0]
t1[label="" pos="0,1.5!"]
t2[label="" pos="0,0.5!"]
t3[label="" pos="1,0.5!"]
t4[label="" pos="3,1.5!"]
node[width=2.0 height=0.1]
t5[label="" pos="2.5,2!"]
t6[label="" pos="1.5,2!"]
t7[label="" pos="0.5,2!"]
t8[label="" pos="0.5,0!"]
node[style=normal]
And this does what I want, i.e. removes all overlaps with fixed edges:
However, this is limited only to edges that are perfectly vertical/horizontal(note that there is still at least 1 overlap in "child" nodes), and overall seems like a really hacky solution as I have to add/change those "support beams" every time I add/change any more nodes to my graph. Is there a better solution to this?
I have a graph I want to reproduce using IcCube reporting, (see example below)
I tried using AMChart combo chart type but without succes because there are 4 series of measures, I can do it when there are only 2 but did not succes with 4.
Could someone provide a working example ?
A better solution is to use the standard Serial Chart. With the latest reporting version you can set-up axis that can be used by more than one measure.
This is how to do it:
Create 4 Graphs, a graph for each measure
Set the first two to Column, the 3rd and 4th to line
Create 2 Value axis
Set the 1st and 2nd measure to use the 1st Axis, the 3rd and 4th to the 2nd Axis.
In Live Demo / How To / Stackoverflow - Combo graph with 4 measures - 2nd solution
That is it. All the rest is embellishment.
Create a combo Chart Create a MDX with 3 measures ( One for the bar
values for both Nb 2016 and Nb 2017 -> Nb, one for 2016 Valorisation
and the last one for 2017 Valorisation )
Add 3 Graph Configuration (two first one already exists)
Set the values of the 3 graphs to Nb,
2016 Val, 2017 Val and the chart types to column, line, line.
Use for the 3 graphs the default Value Axis.
This should do it
In Live Demo / How To / Stackoverflow - Combo graph with 4 measure series
How do I import a matrix into Matlab and then visualize it as a surface?
I want to have it something like this at the end:
http://www.mathworks.se/help/matlab/ref/meshgrid.html
to be able to do that I have to first have it as an input of the meshgrid(according to the file) but I have no idea how to do that.
enter link description here
I am completely new in Matlab...
Thanks in advance
The are many possibilities (file formats, visualisation functions, etc) depending on what you would like to achieve. The simplest example I can think of is as follows.
Suppose you have a file named data.txt in your working directory that contains
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15 16
17 18 19 20
Then the commands
M = load('data.txt');
surf(M)
xlabel('x')
ylabel('y')
title('Matrix M')
will give you the following plot
Since the matrix M is not a square matrix, you can see in the plot which dimension is assigned to each axis.
To change the viewpoint you can use the view command. All there is to this command is summarised in this picture
taken from here http://www.mathworks.com/help/matlab/visualize/setting-the-viewpoint-with-azimuth-and-elevation.html
The first argument to be passed to the view command is the azimuth and the second argument is the elevation, as defined in the picture above.
For example, if you want to make the order of the values on the x and y axes appear reversed, you can first read the current azimuth and elevation
% get from current axes the attribute View
current_view = get(gca,'View');
and change it with view(current_view + [180 0]). The result is
You can also rotate a plot interactively: on the toolbar of the Figure window there is a circular arrow. You can click on it to activate it and then click and drag inside the window.
I am using Graphviz 2.30. Horizontal positioning for labels works out, but in a few cases, a modified angle would be desired.
For instance, I tried various values for angle here but without any effect:
ABB -> ABACUS[label="applied", fontname="Arial", fontsize=15, labelangle=110];
How can I display labels in line with (i.e. parallel to) the edge when using a Graphviz digraph.
The entire digraph will not be posted due to an NDA. In addition, the rotation will be applied only to a few labels.
I have read similar threads like this or another (or a thread about alignment for instance) but without any help regarding my issue.
Using dot2latex allows you to specify lblstyle attribute. The value of lblstyle is used by PGF/TikZ in pdf generation.
One can specify parallel labels like this:
digraph G {
edge [lblstyle="above, sloped"];
a -> b [label="ab"];
b -> c [label="bc"];
c -> a [label="ca"];
}
To generate the pdf
$ dot2tex --tikzedgelabel file.dot > file.tex
$ pdflatex file.tex
The result is
Edit: another answer found an option that now exists to align text with edges.
Your best option may be to export the graph as an SVG and use Illustrator or Inkscape to fine-tune it. This is only practical when producing a few graphs.
I frequently have to tweak the output from Graphviz and Gephi; they give me a good starting point though.
I need to write an application in VB6 which makes a scatter plot out of a series of data points.
The current workflow:
User inputs info.
A bunch of calculations go down.
The output data is displayed in a series of 10 list boxes.
Each time the "calculate" button is clicked, 2 to 9 entries are entered into the list boxes.
One list box contains x coordinates.
One list box contains the y coordinates.
I need to:
Scan through those list boxes, and select my x's and y's.
Another list box field will change from time to time, varying between 0 and 100, and that field is what needs to differentiate which series on the eventual graph the x's and y's go into. So I will have Series 1 with six (x,y) data points, Series 26 with six data points, Series 99 with six data points, etc. Or eight data points. Or two data points. The user controls how many x's there are.
Ideally, I'll have a graph with multiple series displaying all this info.
I am not allowed to use a 3rd party solution (e.g. Excel). This all has to be contained in a VB6 application.
I'm currently trying to do this with MS Chart, as there seems to be the most documentation for that. However, this seems to focus on pie charts and other unrelated visualizations.
I'm totally open to using MS Graph but I don't know the tool and can't find good documentation.
A 2D array is, I think, a no go, since it would need to be of a constantly dynamically changing size, and that can't be done (or so I've been told). I would ideally cull through the runs, sort the data by that third series parameter, and then plug in the x's and y's, but I'm finding the commands and structure for MS Chart to be so dense that I'm just running around in very small circles.
Edit: It would probably help if you can visualize what my data looks like. (S for series, made up numbers.)
S X Y
1 0 1000000
1 2 500000
1 4 250000
1 6 100000
2 0 1000000
2 2 6500
2 4 5444
2 6 1111
I don't know MSGraph, but I'm sure there is some sort of canvas element in VB6 which you can use to easily draw dots yourself. Scatter plots are an easy graph to make on your own, so long as you don't need to calculate a line of best fit.
I would suggest looking into the canvas element and doing it by hand if you can't find a tool that does it for you.
Conclusion: MSChart and MSGraph can both go suck a lemon. I toiled and toiled and got a whole pile of nothing out of either one. I know they can do scatter plots, but I sure as heck can't make them do 'em well.
#BlackBear! After finding out that my predecessor had the same problems and just used Pset and Line to make some really impressive graphs, I did the same thing - even if it's not reproducible and generic in the future as was desired. The solution that works, albeit less functionally >> the solution with great functionality that exists only in myth.
If anyone is reading this down the line and has an actual answer about scatter plots and MSChart/Graph, I'd still love to know.