annotate

multiple annotate Sum terms yields inflated answer

对着背影说爱祢 提交于 2019-11-30 06:50:31
In the following setup, I'd like a QuerySet with a list of projects, each annotated with the sum of all its task durations (as tasks_duration) and the sum of all of its tasks' subtask durations (as subtasks_duration). My models (simplified) look like this: class Project(models.Model): pass class Task(models.Model): project = models.ForeignKey(Project) duration = models.IntegerField(blank=True, null=True) class SubTask(models.Model): task = models.ForeignKey(Task) duration = models.IntegerField(blank=True, null=True) I make my QuerySet like this: Projects.objects.annotate(tasks_duration=Sum(

Insert custom annotation in java 'field' using annotate plugin + JAXB (upon xsd -> java)

荒凉一梦 提交于 2019-11-30 03:49:32
问题 Use case: Wanna insert custom annotation to fields in java class generated by JAXB Problem: Using Annotate plugin + JAXB [1], am able to successfully insert custom annotations but they are getting inserted at getter method rather than field. Morphia (mongo DB) annotations (that i actually want to insert) however can annotate only java fields [2]. My test xsd: <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" jaxb:version="2.1" xmlns:annox=

Django - How can you include annotated results in a serialized QuerySet?

痴心易碎 提交于 2019-11-29 16:06:42
How can you include annotated results in a serialized QuerySet? data = serializer.serialize(Books.objects.filter(publisher__id=id).annotate(num_books=Count('related_books')), use_natural_keys=True) However the key/value pare {'num_books': number} is not include into the json result. I've been searching for similar questions on the internet, but i didn't found a solution that worked for me. Here is a similar case: http://python.6.x6.nabble.com/How-can-you-include-annotated-results-in-a-serialized-QuerySet-td67238.html Thanks! I did some research and found that serializer.serialize can only

How to use ClearCase Annotate

血红的双手。 提交于 2019-11-29 08:08:32
I'm trying to use annotate but have a problem: The output ignores some information (date and username) if it was displayed for the same version before. I'd like to display them in any line. This is my command: cleartool annotate -out - -rm -nhe -fmt "%Sd ||| %-12.12u ||| %Vn ||| ,,%Vn ||| " -rmf "" "G:\views\myview\myprojectvob\Form1.frm@@\main\john_myprject\12" That's the output. I'd like to get date and username for the second and third lines as well. Do you know if that's possible? 2008-05-22 ||| john ||| \main\john_myproject\10 ||| End Sub \main\john_myproject\10 ||| \main\john_myproject

multiple annotate Sum terms yields inflated answer

扶醉桌前 提交于 2019-11-29 07:04:53
问题 In the following setup, I'd like a QuerySet with a list of projects, each annotated with the sum of all its task durations (as tasks_duration) and the sum of all of its tasks' subtask durations (as subtasks_duration). My models (simplified) look like this: class Project(models.Model): pass class Task(models.Model): project = models.ForeignKey(Project) duration = models.IntegerField(blank=True, null=True) class SubTask(models.Model): task = models.ForeignKey(Task) duration = models

Custom arrow style for matplotlib, pyplot.annotate

倾然丶 夕夏残阳落幕 提交于 2019-11-29 02:05:13
I am using matplotlib.pyplot.annotate to draw an arrow on my plot, like so: import matplotlib.pyplot as plt plt.annotate("",(x,ybottom),(x,ytop),arrowprops=dict(arrowstyle="->")) I want to use an arrow style that has a flat line at one end and an arrow at the other, so combining the styles "|-|" and "->" to make something we might call "|->", but I can't figure out how to define my own style. I thought I might try something like import matplotlib.patches as patches myarrow = patches.ArrowStyle("Fancy", head_length=0.4,head_width=0.2) (which should just be the same as "->" for now; I can tweak

How to annotate ggplot2 qplot outside of legend and plotarea? (similar to mtext())

蓝咒 提交于 2019-11-28 12:03:46
I would like to annotate my plots with a filename. With plot() I used mtext : plot(1:10) mtext("File xy-12-34-56.csv", 4) How can I do that with ggplot2 and qplot or ggplot? It should not collide with the legend. I found the commands annotate and grid , but I could not get an annotation similar to mtext with these. As a workaround I could try watermarks , but perhaps you have a good hint for me. Kind regards, Jonas Update Looks like to achieve the result now we should use the following: library(ggplot2) library(grid) library(gridExtra) p <- qplot(data = mtcars, wt, mpg) grid.arrange(p, right =

how to use imagick annotateImage for chinese text?

大憨熊 提交于 2019-11-28 11:20:08
I need to annotate an image with Chinese Text and I am using Imagick library right now. An example of a Chinese Text is 这是中文 The Chinese Font file used is this The file originally is named 华文黑体.ttf it can also be found in Mac OSX under /Library/Font I have renamed it to English STHeiTi.ttf make it easier to call the file in php code. In particular the Imagick::annotateImage function I also am using the answer from "How can I draw wrapped text using Imagick in PHP?" . The reason why I am using it is because it is successful for English text and application needs to annotate both English and

Show the value of a geom_point using geom_text

本秂侑毒 提交于 2019-11-28 11:03:07
问题 Using this nice code from here: countries <- structure(list(country = structure(c(5L, 6L, 3L, 4L, 10L, 8L, 11L, 7L, 1L, 13L, 9L, 12L, 2L), .Label = c("Australia", "China", "France", "Georgia", "India", "Ireland", "Malaysia", "Poland", "Qatar", "Singapore", "South Africa", "Spain", "USA"), class = "factor"), Latitude = c(20.593684, 53.142367, 46.227638, 32.165622, 1.352083, 51.919438, -30.559482, 4.210484, -25.274398, 37.09024, 25.354826, 40.463667, 35.86166), Longitude = c(78.96288, -7.692054

How can I wrap text using Imagick in PHP so that it is drawn as multiline text?

牧云@^-^@ 提交于 2019-11-27 20:54:36
The Imagick library in PHP allows you to draw text on top of an image. How can I tell Imagick to wrap the text based upon some bounded text box, so that the words appear as multiline text rather than a single line? Usage: list($lines, $lineHeight) = wordWrapAnnotation($image, $draw, $msg, 140); for($i = 0; $i < count($lines); $i++) $image->annotateImage($draw, $xpos, $ypos + $i*$lineHeight, 0, $lines[$i]); Function: /* Implement word wrapping... Ughhh... why is this NOT done for me!!! OK... I know the algorithm sucks at efficiency, but it's for short messages, okay? Make sure to set the font