Why am I getting "Invalid GPT fixed size specification" - google-dfp

I'm getting:
Invalid GPT fixed size specification: [[[1024,0],[970,90]],[[768,0],[728,90]],[[330,0],[320,50]]]
My size mapping code looks like this:
window.googletag
.sizeMapping()
.addSize([1024, 0], [970, 90])
.addSize([768, 0], [728, 90])
.addSize([330, 0], [320, 50])
.build()
Does anything look off?

Your script specifies the following :
When viewport >= 1024px wide, ads sized 970x90 may serve.
When 1024px > viewport >= 768px, ads sized 728x90 may serve.
When 768px > viewport >= 330px, ads sized 330x50 may serve.
But what is happening for lower viewport width ? You need to cover all viewport sizes range, starting from 0x0 :
var mapping = googletag.sizeMapping()
.addSize([1024, 0], [970, 90])
.addSize([768, 0], [728, 90])
.addSize([0, 0], [320, 50])
.build()
See here for official documentation.
EDIT : the error is about the fixed size, so when you define your slot, you just need to declare the possible creative sizes, not the associated viewport, and THEN apply the sizeMapping :
googletag.defineSlot('/yourAdPath/',[[970, 90], [728, 90], [320, 50]], 'targetId')
.defineSizeMapping(mapping)
.addService(googletag.pubads());
Detailed here

Related

Horizontal axis labels are not using 100% width (Google Charts)

Here is a chart rendered using one of the Google Charts demos. My actual use case is very similar to this, a vertical axis with integer labels and a horizontal axis with string labels.
Fiddle: https://jsfiddle.net/1f0dvehq/
The X-axis has the labels starting at what seems to be an arbitrary distance from 0,0. I need those red and blue lines to start at X=0, and have the first X-axis label shift so that it sits below 0,0, as in the following screenshot:
I have tried passing minValue options to the horizontal axis via hAxis but this doesn't seem to work with strings like it does with integers.
The following options are being passed to the fiddle chart (again, from the demo code):
var options = {
title: 'Company Performance',
curveType: 'function',
legend: { position: 'bottom' }
};
How can I align the X axis labels so they take up 100% of the chart width, with the first label falling underneath the Y axis itself? I would like to accomplish this from within the chart configuration itself if possible, rather than CSS or extraneous JS.
If anyone could also explain the logic of this setting it would be much appreciated. It strikes me as odd that it's the default setting, and from my experience with google frameworks they usually choose default values that adhere to a convention, but this seems nonsensical. I would expect the "2004" label to be left justified on the X-axis, and the intervals between the X labels to be evenly spaced with "2007" flush against the right edge of the chart.
can't explain why, but this is default behavior for a discrete axis.
if you would like to display strings on the x-axis,
but still have the behavior of a continuous axis,
you can use the ticks option to format the axis labels.
using object notation, you can provide the value (v:) of each tick,
as well as the formatted value (f:)...
{v: 0, f: '2004'}
see following working snippet...
google.charts.load('current', {
packages: ['corechart']
}).then(function () {
var data = google.visualization.arrayToDataTable([
['Year', 'Sales', 'Expenses'],
[0, 1000, 400],
[1, 1170, 460],
[2, 660, 1120],
[3, 1030, 540]
]);
var options = {
title: 'Company Performance',
curveType: 'function',
legend: {position: 'bottom'},
hAxis: {
ticks: [
{v: 0, f: '2004'},
{v: 1, f: '2005'},
{v: 2, f: '2006'},
{v: 3, f: '2007'}
]
}
};
var chart = new google.visualization.LineChart(document.getElementById('curve_chart'));
chart.draw(data, options);
});
<script src="https://www.gstatic.com/charts/loader.js"></script>
<div id="curve_chart"></div>

Can silver-colored mesh be drawn in Matlab?

I would like to know how to draw the following meshes in such color in Matlab. The images are extracted from Microsoft paper on Kinect (link). It seems there is no default colormap of these sort. Do I need to create a new colormap?
The image shown is from figure 1, where they write that the lighting is Phong-shaded renderings (greyscale). This is what you call "silver-colored", i.e. colormap('gray') combined with reflections.
A quick google search suggests you looking at https://se.mathworks.com/matlabcentral/fileexchange/35240-matlab-plot-gallery-change-lighting-to-phong/content/html/Lighting_Phong.html
I've tried to make a custom milky colormap.
trisurf(tri, vertex(:, 1), vertex(:, 2), vertex(:, 3), 0, 'edgecolor', 'none');
axis equal;
axis vis3d;
light('Position', [0 0 1], 'Style', 'infinite');
colormap jet;
map = [0.83,0.82,0.78
1,1,1];
colormap(map);
lighting phong;
The result goes like this,

How can I expand the webcam´s window? MATLAB

I have followed this tutorial Acquire Images from Webcams but when I make the preview of the image with
preview(cam) the image appears small and i want the image in fullscreem.
I have proved with set(gcf,'units','normalized','outerposition',[0 0 1 1]) but it doesnt work.
How can I expand the preview image? Thanks a lot
Finally I found a solution. I hope it is useful for someone
%% Create a webcam object called cam
cam = webcam;
cam.Resolution = '1280x720';
dimensions = get(0, 'ScreenSize'); %your screem
figure('Toolbar','none',...
'Menubar', 'none',...
'NumberTitle','Off',...
'Position', [1 1 dimensions(3) dimensions(4)], ... % Position, pixels[x, y, width, height]
'Name','My Preview Window');
hImage = image(zeros(720, 1280, 3));
preview(cam, hImage);

How to find diameter of image using matlab?

I have images of a leaf,now I want to find the diameter of the leaf using matlab, for feature extraction
]1
An help would be appreciated.
In your image you want scan the pixels top to bottom and bottom to top,and get the first pixel values,using this pixels you can get diameter.The same method using in left to right and right to left manner.then you find the maximum value as your diameter.
This is code for mark first pixels,try this.
%Mark horizontal pixel
[row1, column1] = find(thinImg, 1, 'last');
hold on;
plot(column1, row1, 'yX', 'MarkerSize', 15);
%Mark vertical pixel
[row2, column2] = find(thinImg, 1, 'first');
hold on;
plot(row2, column2, 'yX', 'MarkerSize', 15);

Can Google Charts support dual y-axis (v-axis)?

The Flot chart api supports dual v-axis scales, as shown by this example.
I'm using Google Charts - is this possible also with Google? I've had a look through the examples and docs, but can't find any examples / references to indicate it does support dual axis charts.
It took me a while, to figure this out, but Google Charts does support dual Y-axis (v-axis). I want to use the Javascript API and not the HTML interface.
This example can be tested here:
http://code.google.com/apis/ajax/playground/?type=visualization#line_chart
Replace all of that code with this code showing how to have two different Y-axis scales:
function drawVisualization() {
// Create and populate the data table.
var data = new google.visualization.DataTable();
data.addColumn('string', 'x');
data.addColumn('number', 'Cats');
data.addColumn('number', 'Blanket 1');
data.addColumn('number', 'Blanket 2');
data.addRow(["A", 1, 1, 0.5]);
data.addRow(["B", 2, 0.5, 1]);
data.addRow(["C", 4, 1, 0.5]);
data.addRow(["D", 8, 0.5, 1]);
data.addRow(["E", 7, 1, 0.5]);
data.addRow(["F", 7, 0.5, 1]);
data.addRow(["G", 8, 1, 0.5]);
data.addRow(["H", 4, 0.5, 1]);
data.addRow(["I", 2, 1, 0.5]);
data.addRow(["J", 3.5, 0.5, 1]);
data.addRow(["K", 3, 1, 0.5]);
data.addRow(["L", 3.5, 0.5, 1]);
data.addRow(["M", 1, 1, 0.5]);
data.addRow(["N", 1, 0.5, 1]);
// Create and draw the visualization.
new google.visualization.LineChart(document.getElementById('visualization')).
draw(data, {curveType: "function", width: 500, height: 400,
vAxes: {0: {logScale: false},
1: {logScale: false, maxValue: 2}},
series:{
0:{targetAxisIndex:0},
1:{targetAxisIndex:1},
2:{targetAxisIndex:1}}}
);
}
By adding maxValue: 2 to the code, and setting series 1 & 2 to that axis, they work properly on a second axis.
Non-JavaScript solution
Assuming that you are looking for a series that shares that same X-axis (horizontal) but has different values (and scales) for the Y-axis (vertical) then you can do this without recourse to JavaScript as follows:
Select Insert | Chart from the menu.
Double-click the chart, and in the chart editor select Chart Type | Line chart.
Click the grid icon in the "Data range" box to get the data range dialog.
Click the worksheet containing the data you're interested in for the Y-axis lines and highlight from the top left to the bottom right so you cover all the Y-axis lines. You can tidy up the columns later.
Click OK and you'll see a collection of series has been extracted. Use the "dot menu" for each series to remove those you're not interested in.
Click the grid icon in the "X-axis" box to the get the data range dialog once again.
Click the worksheet containing the data you're interested in for the X-axis line and highlight from the top to the bottom.
Click OK and you'll see the X-axis has been filled in and both Y-axis lines are sharing the same left axis label.
Click on the line you want to use the right axis label for and use the "Axis" box in the chart editor dialog to select "Right axis".
You can now edit the various other properties of the chart to get it to look the way you want in terms of presentation.
I did it.
Click on the data series
A small box will appear with 2 small squares with only two bold sides each
Click on the second one
Might be done then.