Menu
  • HOME
  • TAGS

Matlab plot legend automation

matlab,plot,legend,legend-properties

Because you predefined legnd as a cell array, you need to use {} instead of () to get the correct index. Try: legnd{i} = sprintf('t = %0.2f s \n', t(tsampled(i))); ...

Matplotlib automatic legend outside plot

python,matplotlib,plot,legend,legend-properties

This one is easier to understand: import matplotlib.pyplot as plt x = [1,2,3] plt.subplot(211) plt.plot(x, label="test1") plt.plot([3,2,1], label="test2") plt.legend(bbox_to_anchor=(0, 1), loc='upper left', ncol=1) plt.show() now play with the to coordinates (x,y). For loc you can use: valid locations are: right center left upper right lower right best center lower left...

Matplotlib scatter plot different colors in legend and plot

python-2.7,matplotlib,legend,legend-properties,colormap

In your plot there are different colors for the error bars and the scatter plot points. You can make them the same like this: c = next(colors) ax.errorbar(df2a['x_var_plot'], df2a[col], color = c, yerr=df2a_err[col], fmt='o') ax.scatter(df2a['x_var_plot'], df2a[col], color = c, label=col) ...

Highcharts Legend item text alignment

highcharts,legend,jscript,legend-properties

For this you need to set useHTML: true, and define html elements in the labelFormatter function, and set the widths of those elements via CSS. Example: http://jsfiddle.net/jlbriggs/yra1rw51/ (there are numerous ways to set up the HTML and CSS to accomplish this - this is just one example)...

Getting rid of the empty space after the legend property

html,css,legend-properties

The browser default css of the <ul> has margin and padding of non zero values. Set these to 0. ul { margin: 0; padding: 0; } Use a normalize.css like here on github/nomalize. This will do the above and some other stuff, which makes the different browser default css more...

Legend in gplotmatrix

matlab,data,plot,legend,legend-properties

The legend created by gplotmatrix can be found because it has the 'Tag' property set to 'legend' (at least in Matlab R2010b). So: featMat = rand(10,3); classVec = rand(10,1) > 0.3; gplotmatrix(featMat, [], classVec, ['g','r']); h = findobj('Tag','legend'); set(h, 'String', {'Text1', 'Text2'}) ...

How to add a string as the artist in matplotlib legend?

python,matplotlib,legend,legend-properties

I don't think there's a legend handler for text (see the list of available ones here). But you can implement your own custom legend handler. Here I'll just modify the example at the above link: import matplotlib.pyplot as plt import matplotlib.text as mpl_text class AnyObject(object): def __init__(self, text, color): self.my_text...

How to show tooltip on a Google Pie Chart on legend hover?

charts,google-visualization,legend,mousehover,legend-properties

You are close. Keep tooltip: { trigger: 'selection' } and add an event listener to onmouseover : google.visualization.events.addListener(chart, 'onmouseover', function(entry) { chart.setSelection([{row: entry.row}]); }); This will show the tooltip when the mouse hover the legend. As the docs says about onmouseover: Fired when the user mouses over a visual entity....