grid

use npc units in annotate()

不羁的心 提交于 2021-01-19 06:39:07
问题 I have a ggplot object. I would like to add some text with annotate() , and I would like to specify the coordinates of the text in npc units. Is this possible? This minimal example demonstrates how text is ordinarily positioned with annotate() : library(ggplot2) p <- ggplot(mtcars, aes(mpg, wt)) + geom_point() p + annotate("text", x = 30, y = 4.5, label = "hello") I would like to achieve the same effect, but instead of specifying x and y in native coordinates, I would like to specify them

Extracting data from raster file to match with shp file

家住魔仙堡 提交于 2020-12-15 05:41:28
问题 UPDATE: UPDATE: The problem was that my way to produce the grid cells has led to a wrong projection of my shapefile which resulted in the above mentioned error. I was able to produce another form of grid cells that worked perfectly with my projection. After I successfully created a raster grid for the world map (How to generate 10x10km grid cells of all countries?) library(sf) library(stars) library(rnaturalearth) # Polygon world = ne_countries(scale = "small", returnclass = "sf") world = st

Tkinter Grid Problem - Frames not aligned

你说的曾经没有我的故事 提交于 2020-12-13 03:18:20
问题 I just started to work with tkinter and I'm still trying to get used to how it works. I was trying to prepare some sort of grid menu with 4 sections. There is one frame at the top with the title of the app, one frame on the left with some buttons to configure the app and then, 4 equally sized frames in the rest. My main issue here is the blank column between the left frame and the other four, how can I adjust this so the 4 squares fill in that space? See below the code: import datetime import

matplotlib: grid in 3D plots

非 Y 不嫁゛ 提交于 2020-12-01 12:14:26
问题 In matplotlib , how can I show a grid in 3D scatter plot? In 2D plots I just do: plt.grid(True) and it works like a charm. Now with 3D plots the same call returns a warning: File "/usr/lib/pymodules/python2.7/matplotlib/pyplot.py", line 2792, in grid ret = gca().grid(b, which, axis, **kwargs) TypeError: grid() takes at most 2 arguments (4 given) How do I do this? 回答1: You can use the grid method of the axes to turn the grid on and off. import matplotlib.pyplot as plt from mpl_toolkits.mplot3d