legend

How to make tabular legend using matplotlib and python

让人想犯罪 __ 提交于 2020-01-05 04:41:30
问题 I am plotting a choropleth map in python from a shapefile and i want to customize the legend of the plot, i am using the code bellow: import pandas as pd import pysal as ps import geopandas as gp import numpy as np import matplotlib.pyplot as plt pth = 'outcom.shp' tracts = gp.GeoDataFrame.from_file(pth) ax = plot_dataframe(tracts, column='Density', scheme='QUANTILES', k=4, colormap=plt.cm.Blues, legend=True) plt.show() Besides, i am using a small patch that i found here http://nbviewer

d3.js legend overlapping chart area

浪尽此生 提交于 2020-01-05 04:32:08
问题 I'm pretty new to D3.js (I'm a R programmer). I'm trying to create a scatter and put a legend in the right bottom. However, it's overlapping with chart area. I've been trying to take some examples in internet with no lucky. When I try to move it to the right, the names and/or symbols are not visible. I want to place the legend outside the chart frame, so it won't overlap. Any help is appreciated. Here's what I tried so far: d3.csv('https://gist.githubusercontent.com/netj/8836201/raw

Controlling margins in a genoPlotR plot_gene_map

浪子不回头ぞ 提交于 2020-01-05 03:25:11
问题 I'm producing a plot_gene_map figure by the genoPlotR R package, which gives a horizontal phylogenetic tree where aligned with each leaf is a genomic segment. Here's a simple example that illustrates my usage and problem: The plot_gene_map function requires an ade4 s' package phylog object which represents the phylogenetic tree: tree <- ade4::newick2phylog("(((A:0.08,B:0.075):0.028,(C:0.06,D:0.06):0.05):0.0055,E:0.1);") A list of genoPlotR 's dna_seg objects (which are essentially data.frame

How to create a basic legend to a multicolored line?

China☆狼群 提交于 2020-01-04 14:20:54
问题 I am currently finishing a bigger project and the last part is to add a simple legend to a plot of a multicolored line. The line only contains two different colors. The following image shows the plot when created. The next image shows the same plot with higher resolution. The plot displays the distance between Earth and Mars over time. For the months March to August the line is orange, for the other months it's blue. The legend should come in a simple box in the upper right corner of the plot

R heatmap.2 manual grouping of rows and columns [duplicate]

爷,独闯天下 提交于 2020-01-04 05:45:07
问题 This question already has answers here : How to create pre-annotated rowside column in heatmap.2 (2 answers) Closed 2 years ago . I have the following MWE in which I make a heatmap without performing any clustering and showing any dendrogram. I want to group my rows (genes) together in categories, in a better looking way than how it is now. This is the MWE: #MWE library(gplots) mymat <- matrix(rexp(600, rate=.1), ncol=12) colnames(mymat) <- c(rep("treatment_1", 3), rep("treatment_2", 3), rep(

Matlab: How to set color of legend in a scatter plot where each data point gets a different color?

别等时光非礼了梦想. 提交于 2020-01-04 05:42:10
问题 Here is the sample code: x = rand(100,1); y = rand(100,1); score = rand(100,1); figure; colormap(flipud(bone)); caxis([0 1]) axis([0 1 0 1]) scatter(x,y,50,score,'+','LineWidth',2); legend('scores'); I'm using the reversed 'bone' colormap which assigns pure white to score value 0 and pure black to score value 1. However, the legend seems to be automatically assigned the score 0, and so if you run the code the legend color is pure white and not visible. Is there any ways to fix that? Thanks.

How to make a Legend of MatPlotLib patch patterns or add them to a preexisting Legend

♀尐吖头ヾ 提交于 2020-01-04 02:58:05
问题 How does one make a legend for patch patterns used on a graph or add information on the patch patterns to a preexisting legend without affecting information already present on the legend? 回答1: When you create the patch include the kwarg label , ex ## bunch of code ax.add_patch(mpl.patches.Rectangle(...,label='fail')) ## bunch of code ax.plot(...,label='some line') ## bunch of code ax.legend() and it will be automaigically added to your legend. And entry will be added for each artist that you

How to create one common legend for 4 subplots in MATLAB?

╄→гoц情女王★ 提交于 2020-01-04 02:48:29
问题 How can I create one common legend for 4 subplots in MATLAB, like this: 回答1: Quick and dirty: hSub = subplot(3,1,1); plot(1,1,1,1,1,1,1,1); hLegend = legend('hello','i','am','legend'); subplot(3,2,3), plot(10:-1:1); subplot(3,2,4), plot(1:100); subplot(3,2,5), stem(1:10); subplot(3,2,6), plot(randn(1,100)) set(hLegend, 'position', get(hSub, 'position')); 来源: https://stackoverflow.com/questions/26704815/how-to-create-one-common-legend-for-4-subplots-in-matlab

Highcharts add legend on export

我的梦境 提交于 2020-01-03 17:17:07
问题 I'm trying to add a legend on a pie when exporting the chart as PNG. Here is my code : var chart_23_106; $(document).ready(function () { chart_23_106 = new Highcharts.Chart({ chart: { type: 'pie', renderTo: 'container_23_106', plotBackgroundColor: null, plotBorderWidth: null, plotShadow: false }, title: { text: 'NRJ' }, tooltip: { pointFormat: '{series.name}: <b>{point.percentage}%</b>', percentageDecimals: 1 }, plotOptions: { pie: { borderWidth: 0, shadow: false, allowPointSelect: true,

multiple markers in legend

柔情痞子 提交于 2020-01-03 15:33:36
问题 My script for plotting creates two legends for each label. I do not know how to make legend() not duplicate. I checked on stackoverflow and found two methods. But I could not implement them here. Any ideas? Matplotlib: Don't show errorbars in legend Stop matplotlib repeating labels in legend symbols = [u'\u2193'] #Plotting our vsini values for i, symbol in enumerate(symbols): for x0,y0 in zip(vsini_slit_cl, vsini_slit): plt.text(x0,y0, symbol, fontname='STIXGeneral', size = 10, va='center',