Hot answers tagged

40

In QGIS 2.8 Composer, there's a Wrap text on option in the Item properties tab when you add a legend which lets you enter a character where you want the new line to start. What I normally do is use the * character in the layer's name for where I want the new line. Then input the * into the Wrap text option. (I'm using QGIS 2.8.2-Wien):


36

Another option is to add a rectangle shape to the composition, then style the rectangle using a gradient fill with the same color ramp as your raster. This can be done directly in QGIS, no image editing or html required.


32

Here is a really simple example library(raster) data(volcano) volcanoR <- raster(volcano) #making colors below 100 red and above 180 blue in this example breakpoints <- c(94,100,120,140,160,180,195) colors <- c("red","white","white","white","white","blue") plot(volcanoR,breaks=breakpoints,col=colors) You just need to pass the plot a vector of ...


26

In 10.1 you have a lot more control over legends. You should be able to wrap both the labels and the description using the Text Wrapping option in the Layout tab (see below) If that still doesn't work you can manually force the line breaks using the Symbology tab in the Layer Properties. If you right click each of your unique values and select Edit ...


19

You could listen for the "overlayadd" and/or the "overlayremove" events on the map object and have two separate legends (two controls) defined, e.g.: map.on('overlayadd', function (eventLayer) { // Switch to the Population legend... if (eventLayer.name === 'Population') { this.removeControl(populationChangeLegend); populationLegend....


16

Here you find the map including the legend. The legend is in German, but I am German, so I tried to translate it as precise as possible. I think (and please @Giancarlo correct me, if you disagree): 1 is "Reichsstraße, ausgebaut". That means a well-developed street. 2 is propably a sort of drainage system or stream (thank you @AndreJ). It is not named in ...


15

In layout view, open the legend properties and browse to the Items tab (see above picture) where you can specify which items show the count. If you were asking specifically about showing the count in the Table of Contents, I'm not sure how this can be done. I looked around but only found this helpfile from ArcMAP that states For example, you can use ...


15

The method we use is to have a duplicate copy of the layer just for the legend. After the map layer looks the way you want, just drag the layer from the TOC and on to the map to make a duplicate. We append '_map' to the name of the map layer version to differentiate between the two layers. Then the symbology size or width can be adjusted for each icon or ...


15

I have managed this earlier by following this workflow: Double-click the Legend in the Layout. Legend Properties > Items tab. Select the layer in the list and click the Style button. Click the Properties button. Go to the General tab and click Label Symbol. Click the Edit Symbol button. Then use the X and Y offset values to move the labels to the left - for ...


12

To start with I will drop this website as a resource you should tie into. your sequences are actually backward. your fourth has to be the first thing you attempt. (something I learned long ago is to plan what you want to end up with and then work back to where you are so you are sure you will end up with what you want [not something else]). 1. you need a ...


12

Uncheck the "auto update" box. This makes it possible to remove fields from the Print Composer without removing them from the project. You can't remove a parent without removing the children. However, you can click the Edit Text (pencil) icon, erase all the text, and the legend will eliminate the whitespace.


11

There is no need to write any additional ArcPy for this. Simply use dynamic legends (which were added at ArcGIS 10.1) when you are authoring your maps. The Map Extent Options allow you to control how eligible legend items interact with the current map extent. If the Only show classes that are visible in the current map extent check box is checked, a ...


11

It's definitely a major pain when ArcMap tries to be, um, helpful even when you really don't want it to be. One workaround I've found is to create a new temporary dataset, and add a few points with the minimum and maximum values that you know you'll need in the output - just be sure to cover the whole range. Create your symbology based on this fake dataset ...


11

Decrease the height of the the legend box to zero: In the example below you can see that I got a line legend even if my data is polygon. Right-click on your legend, click on properties Go to the Legend tab and change the height into either 1 or 0. That will reduce all polygon layer patches in the legend to lines. You can also set this property per-layer, ...


10

A workaround without pictures is to add the gradient using a HTML frame and some CSS magic: <html> <head> <style type="text/css"> body { background: -webkit-linear-gradient(left,red,orange,yellow,green); } * { color: white; font-family: "Source Sans Pro", Arial, sans; font-size: 24px; } </style></head> <body> <div ...


10

To complement Luigi's answer, this is how you can use the Layer Tree View for adding a legend and/or a ToC to your application. After you create your canvas in your standalone PyQGIS application, you need to create a QgsLayerTreeView. For that, you need a model, and for the model you need the layer tree root. Additionally, you need to use a ...


10

The workaround I usually use for any situation in which I want to customize the legend entry for a layer is to create a dummy layer which is only used in the legend, and not displayed on the map. So in your case, create a new line layer using a line shapefile with no features in it, symbolize it however you want, and add that to your legend. The new layer ...


10

I don't think this is currently possible as there is already an existing ticket which was updated a year ago: http://hub.qgis.org/issues/3239


9

In ArcMap 9 and 10 you can go to Insert > Legend in layout view, and follow the GUI to create & format the legend.


9

Could you use Descriptions? They can handle multiple lines in the legend.


9

Legends for data-defined symbology are not implemented yet. There is an open bug report/feature request: https://issues.qgis.org/issues/11491 Thinking about it, data-defined symbology is extremely powerful and might result in hundreds of different variations of a symbol in color, shape, size, rotation, and so on. It might be unfeasible to really have a ...


9

You just need to cut the data first: library(rgeos) library(maptools) library(raster) library(ggplot2) library(dplyr) library(ggthemes) library(ggalt) library(scales) #load shapefile ken <- getData("GADM", country = "KEN", level = 1) # make it less complex ken <- SpatialPolygonsDataFrame(gSimplify(ken, 0.001, TRUE), data=ken@data) #fortify for ...


9

Here is one solution on top my head: Create a new string field and use field calculator to compute as the concatenation of other fields. Here is the python snippet: !abbrev! + ' ' + !fullname1! +' ('+ !fullname2! + ')' Copy the layer twice in the ArcMap TOC to have three versions of the same layer. Go to properties of each layer and fill the definition ...


9

Use the "Filter Legend by map Content" button. The legend updates and only in the map visible layers are present in the legend (referring to QGIS Version 2.18.6).


9

Since this topic covers a lot of arguments, I will only focus on the SVG symbol layers, hoping that I have understood well what are you looking for (I didn't realize the length of the answer while writing, so I'm sorry for that but I hope it will add more clearness, though). Context 1) Symbol layer classes The following symbol layer classes are available ...


9

I am able to reproduce your error using QGIS 3.2.0, but it works when using QGIS 2.18.21. There are also already a couple of bug reports regarding the size assistant, with this one being probably the most recent and accurate regarding your problem. Having said that, there is the possibility for creating a also cartographic more appealing solution with a ...


9

You can use the "Filter legend by map content" button in the print composer item properties for your legend item. The print composer legend will then only show the layers which are within your composer map view.


8

On the third screen of the legend wizard you have the option to assign the gap that you want between the frame and the object in the legend (this also applied to neatlines). Adjust that until it looks right. I too also convert features to graphics, but this is the very last thing I do on a map; it is no longer tied to the map features and if you change ...


8

You can use CSS border-radius to create circles. For example, put this in your stylesheet/style tag: .legend .circle { border-radius: 50%; width: 10px; height: 10px; margin-top: 8px; } Then add the circle class to the color block when you create the marker: div.innerHTML += '<i class="circle" style="background:' + getColor(...


8

You can multiply the value by 100 in the column definition and then add the % signs in the legend format as shown here:


Only top voted, non community-wiki answers of a minimum length are eligible