How to add title to graph_tool plot? - cairo

I'm using graph_tool to draw some graphs, and I don't see an obvious way to add a title to the output image.
If it is possible, how do I add a title?
The code I have right now draws a nice-looking graph, and I have added annotations to the vertices. But I haven't found a way to annotate the graph as a whole (like a title).
import graph_tool as gt
def draw_graph(g:gt.Graph):
ebet = gt.centrality.betweenness(g)[1]
pos = gt.draw.arf_layout(g)
gt.draw.graph_draw(
g,
pos=pos,
vertex_text=g.vertex_index,
edge_color=ebet,
vertex_size=gt.draw.prop_to_size(g.vertex_properties['size'], ma=50,log=False, power=1),
# vertex_fill_color=g.vertex_properties['size'],
output='tiny.pdf')

Graph-tool is not a full-fledged plot library, it focuses only on drawing graphs. To display titles, axes, legends, etc, it should be used together with matplotlib, as explained here: https://graph-tool.skewed.de/static/doc/demos/matplotlib/matplotlib.html

Related

How to make chart with two data axis in different sytle

How to apply different styles on characters X1 (bold and center/left position) and show asdasd (rightposition) in Y-axis of a table??
reality
edit in paint :)
You can use a multi-level axis for the category axis.
If Excel does not recognize the multi-levels, then you can fix that in the data source dialog.
There is, however, no way to format the axis labels to have different fonts and font sizes for the different levels. Excel simply does not support that.
Edit: there is also no setting to turn the outer level label around. Excel will determine how to show it and there is nothing the user can do to change that.
Don't shoot the messenger.

Create label for conical surface

Is it possible to create labels for conical surfaces in MS-word.
I have a label ready, but it needs to adapt to that the printed label can be pasted on a conical surface (e.g. a coffee cup)
I doubt it. You could try using WordArt: these are predefined shapes, maybe one of those matches what you want to do.
I suspect you'd be better off using a program like Adobe Illustrator, which can convert text to vector images which you can distort any way you like.
The bigger problem is that the label won't fit properly on a shape that is curved in two dimensions: you'll always have folds somewhere.

add simple geometric elements to GUIDE GUI

I am desiging a simple GUI application in Matlab using GUIDE.
I am displayed a number of axis - and I would like to add some simple design elements to make the interface clearer. I would like to draw a colored rectangle around an axis (seperate from the axis)... there are two such axes, each displaying details of some things shown in a third plot, and I would like this color clue to link the details to the overview.
So is it possible to add simple geometric shape objects to a Matlab GUI? I don't see anything but controls in GUIDE but perhaps its possible to add them manually with an explicit command?
It is generally difficult to draw any random shape. Except Square & rectangle, for which you can create panels and change the properties like BorderWidth and HighlightColor.
Since MATLAB GUI is based on Java, you can create any object in MATLAB GUI which can be created in Java. You can refer to this website [1] for further learning.
[1] http://undocumentedmatlab.com/matlab-java-book/

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.

How to draw several graphics in one picture in Mathematica?

Just like hold on in Matlab.
I met this problem when i want to draw several lines in one picture.
The number of lines varies.
Mathematica has a lot of constructs allowing you to combine plots, graphics and images.
I'll give you several examples. You can search the help system to find out more and understand the subtleties of the examples bellow:
Edit
If you want to read/write from/to files, the following code may serve you as a starting guide:
(*Create data*)
data = RandomReal[1, {8, 2}];
(*Put into a file*)
Export["c:\\test.tab", data, "Table"];
(*Read the file into another list*)
rdat = Import["c:\\test.tab", "Table"];
(*And Plot it like before*)
Graphics[{Line##, Red, PointSize[Large], Point /# #} &#rdat]
Mathematica 8 introduced a new versatile function Overlay, which can be used to graphically overlay any type of expression:
Overlay[{Graphics[{Yellow, Disk[]}], "Sun"}]
Use Show to combine graphics objects.
Show[Plot[Sin[x],{x,0,10}], Plot[Cos[x],{x,0,10}]]
EDIT If you want to draw several lines, then build your Graphics object out of several lines:
Graphics[ Table[ Line[{{0,0}, {Cos[x],Sin[x]}}], {x,0,Pi,Pi/10} ] ]
combine graphics primitives like Szabolcs said:
Graphics[ Table[ Line[{{0,0}, {Cos[x],Sin[x]}}], {x,0,Pi,Pi/10} ] ]
but if you are using plot then what you need to do is:
Show[Table[Plot[A Sin[x],{x,0,2 Pi}],{A,0.1,10}]]
Show command allows you to combine the graphics Table produces varying A, each one of them a Plot over x.